<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>
  <link href='https://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css' /><title>Aggregation Pipeline Quick Reference &mdash; MongoDB Manual</title><link rel="shortcut icon" href="https://media.mongodb.org/favicon.ico" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="robots" content="index" />

  <meta name="release" content="4.2.5"/>
  <meta name="version" content="4.2"/>
  <meta name="DC.Source" content="https://github.com/mongodb/docs/blob/v4.2/source/meta/aggregation-quick-reference.txt"/>
  <meta property="og:image" content="http://s3.amazonaws.com/info-mongodb-com/_com_assets/cms/mongodb-for-giant-ideas-bbab5c3cf8.png">
  <meta property="og:image:secure_url" content="https://webassets.mongodb.com/_com_assets/cms/mongodb-for-giant-ideas-bbab5c3cf8.png">
      <link rel="canonical" href="https://docs.mongodb.com/manual/meta/aggregation-quick-reference" />
  
   <link rel="stylesheet" href="../_static/mongodb-docs.css" type="text/css" />
   <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
   <link rel="stylesheet" href="../_static/css/navbar.min.css" type="text/css" />
    
    <script type="text/javascript" src="../_static/lib/jquery.min.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/lib/bootstrap.js"></script>
    <script type="text/javascript" src="../_static/lib/jquery.cookie.js"></script>
    <script type="text/javascript" src="../_static/controller.js"></script>
      <link rel="search" type="application/opensearchdescription+xml" href="https://docs.mongodb.com/osd.xml" title="MongoDB Help"/>
<link rel="author" title="About these documents" href="../about.html" />
<!-- <link rel="index" title="Index" href="../genindex.html" /> -->
<link rel="search" title="Search" href="../search.html" />
<link rel="top" title="MongoDB Manual" href="../index.html" />
<link rel="up" title="Aggregation Reference" href="../reference/aggregation.html" />
<link rel="next" title="Aggregation Commands" href="../reference/operator/aggregation/interface.html" />
<link rel="prev" title="Aggregation Reference" href="../reference/aggregation.html" /><script type='text/javascript'>
   var gptadslots=[];
   var googletag = googletag || {};
   googletag.cmd = googletag.cmd || [];
   (function(){ var gads = document.createElement('script');
      gads.async = true; gads.type = 'text/javascript';
      var useSSL = 'https:' == document.location.protocol;
      gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js';
      var node = document.getElementsByTagName('script')[0];
      node.parentNode.insertBefore(gads, node);
   })();
</script>

<script type="text/javascript">
   googletag.cmd.push(function() {

      var pathname = location.href;
      
      if ( (pathname.indexOf("auth") >= 0) || (pathname.indexOf("security") >= 0) ) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/security', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if ( (pathname.indexOf("crud") >= 0) ||  (pathname.indexOf("query") >= 0) || (pathname.indexOf("insert") >= 0) || (pathname.indexOf("update") >= 0) || (pathname.indexOf("remove") >= 0) || (pathname.indexOf("delete") >= 0) || (pathname.indexOf("aggregation") >= 0) ) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/crud', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("shard") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/sharding', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("replica") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/replication', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("model") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/data-modeling', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("administration") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/support', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("install-mongodb-on-windows") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/install-mongodb-on-windows', [160, 600], 'mongodb-docs-1').addService(googletag.pubads());
      } else if (pathname.indexOf("tutorial/getting-started") >= 0) {
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org/docs_server_gettingstarted', [160, 600], 'mongodb-docs-1').addService(googletag.pubads());
      } else {
         //Adslot 1 declaration
         gptadslots[1]= googletag.defineSlot('/40039723/docs.mongodb.org', [[160,600],[243,202],[293,244]],'mongodb-docs-1').addService(googletag.pubads());
      }
      googletag.pubads().enableSingleRequest();
      googletag.pubads().enableAsyncRendering();
      googletag.enableServices();
   });
</script></head>
<body data-project="manual" data-project-title="MongoDB Manual" data-branch="v4.2" data-enable-marian=1>
  <!-- Google Tag Manager -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-JQHP"
                    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push(
     {'gtm.start': new Date().getTime(),event:'gtm.js'}
   );var f=d.getElementsByTagName(s)[0],
   j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
   '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
   })(window,document,'script','dataLayer','GTM-JQHP');</script>
  <!-- End Google Tag Manager -->
<div id="navbar" data-navprops='{"links": [{"url": "https://docs.mongodb.com/manual/","text": "Server","active": true},{"url": "https://docs.mongodb.com/ecosystem/drivers/","text": "Drivers"},{"url": "https://docs.mongodb.com/cloud/","text": "Cloud"},{"url": "https://docs.mongodb.com/tools/","text": "Tools"},{"url": "https://docs.mongodb.com/guides/","text": "Guides"}]}'></div>
      <script>
        window.googleSearchCx = "017213726194841070573:WMX6838984"
	window.googleSearchPlaceholder = "Search Documentation"
        window.googleSearchResultsUrl = "http://docs.mongodb.com/manual/search/"
      </script>
    <script src="../_static/navbar.min.js"></script>
  

  <div class="content" >

   <div id="left-column">
         <aside id="sidebar" class="sidebar">
             
  <div class="sphinxsidebar" id="sphinxsidebar">
    <div id="sphinxsidebarwrapper" class="sphinxsidebarwrapper"><a href="javascript:void(0)" class="closeNav" id="closeNav">Close &times;</a>


<h3>
  <a class="index-link" href="../index.html">MongoDB Manual</a>
</h3>


    <div class="btn-group version-sidebar">
      <button type="button" class="version-button dropdown-toggle" data-toggle="dropdown">
        
        
        Version 4.2 (current)<span class="caret"></span>
      </button>
      <ul class="dropdown-menu" role="menu">
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="master">
              
              Version 4.4 (upcoming)
            </a>
          </li>
        
          
          <li class="active">
          
            <a href="#" data-path="manual">
              
              Version 4.2 (current)
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v4.0">
              
              Version 4.0
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v3.6">
              
              Version 3.6
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v3.4">
              
              Version 3.4
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v3.2">
              
              Version 3.2
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v3.0">
              
              Version 3.0
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v2.6">
              
              Version 2.6
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v2.4">
              
              Version 2.4
            </a>
          </li>
        
          
          <li>
          
            <a class="version-selector" href="#" data-path="v2.2">
              
              Version 2.2
            </a>
          </li>
        
      </ul>
    </div>


<ul class="current"><li class="toctree-l1"><a class="reference internal" href="../introduction.html">Introduction</a><ul><li class="toctree-l2"><a class="reference internal" href="../tutorial/getting-started.html">Getting Started</a></li><li class="toctree-l2"><a class="reference external" href="https://docs.atlas.mongodb.com/getting-started/">Create an Atlas Free Tier Cluster</a></li><li class="toctree-l2"><a class="reference internal" href="../core/databases-and-collections.html">Databases and Collections</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/views.html">Views</a></li><li class="toctree-l3"><a class="reference internal" href="../core/materialized-views.html">On-Demand Materialized Views</a></li><li class="toctree-l3"><a class="reference internal" href="../core/capped-collections.html">Capped Collections</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/document.html">Documents</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/bson-types.html">BSON Types</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/bson-type-comparison-order.html">Comparison/Sort Order</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/mongodb-extended-json.html">MongoDB Extended JSON (v2)</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/mongodb-extended-json-v1.html">MongoDB Extended JSON (v1)</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a><ul><li class="toctree-l2"><a class="reference internal" href="../administration/install-community.html">Install MongoDB Community Edition</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/install-on-linux.html">Install on Linux</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-on-red-hat.html">Install on Red Hat</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-on-red-hat-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-on-ubuntu.html">Install on Ubuntu</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-on-ubuntu-tarball.html">Install using .tgz Tarball</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/installation-ubuntu-community-troubleshooting.html">Troubleshoot Ubuntu Installation</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-on-debian.html">Install on Debian</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-on-debian-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-on-suse.html">Install on SUSE</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-on-suse-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-on-amazon.html">Install on Amazon</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-on-amazon-tarball.html">Install using .tgz Tarball</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/install-mongodb-on-os-x.html">Install on macOS</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-on-os-x-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/install-mongodb-on-windows.html">Install on Windows</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-on-windows-unattended.html">Install using msiexec.exe</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/install-enterprise.html">Install MongoDB Enterprise</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/install-enterprise-linux.html">Install on Linux</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-red-hat.html">Install on Red Hat</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-red-hat-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-ubuntu.html">Install on Ubuntu</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-ubuntu-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-debian.html">Install on Debian</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-debian-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-suse.html">Install on SUSE</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-suse-tarball.html">Install using .tgz Tarball</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-amazon.html">Install on Amazon</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-amazon-tarball.html">Install using .tgz Tarball</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-os-x.html">Install on macOS</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-windows.html">Install on Windows</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-on-windows-unattended.html">Install using msiexec.exe</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/install-mongodb-enterprise-with-docker.html">Install with Docker</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/upgrade-community-to-enterprise.html">Upgrade MongoDB Community to MongoDB Enterprise</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/upgrade-to-enterprise-standalone.html">Upgrade to MongoDB Enterprise (Standalone)</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/upgrade-to-enterprise-replica-set.html">Upgrade to MongoDB Enterprise (Replica Set)</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/upgrade-to-enterprise-sharded-cluster.html">Upgrade to MongoDB Enterprise (Sharded Cluster)</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/verify-mongodb-packages.html">Verify Integrity of MongoDB Packages</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../mongo.html">The <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a><ul><li class="toctree-l2"><a class="reference internal" href="../tutorial/configure-mongo-shell.html">Configure the <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/access-mongo-shell-help.html">Access the <code class="docutils literal"><span class="pre">mongo</span></code> Shell Help</a></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/write-scripts-for-the-mongo-shell.html">Write Scripts for the <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a></li><li class="toctree-l2"><a class="reference internal" href="../core/shell-types.html">Data Types in the <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/mongo-shell.html"><code class="docutils literal"><span class="pre">mongo</span></code> Shell Quick Reference</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../crud.html">MongoDB CRUD Operations</a><ul><li class="toctree-l2"><a class="reference internal" href="../tutorial/insert-documents.html">Insert Documents</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/insert-methods.html">Insert Methods</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/query-documents.html">Query Documents</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/query-embedded-documents.html">Query on Embedded/Nested Documents</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/query-arrays.html">Query an Array</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/query-array-of-documents.html">Query an Array of Embedded Documents</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/project-fields-from-query-results.html">Project Fields to Return from Query</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/query-for-null-fields.html">Query for Null or Missing Fields</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/iterate-a-cursor.html">Iterate a Cursor in the <code class="docutils literal"><span class="pre">mongo</span></code> Shell</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/update-documents.html">Update Documents</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/update-documents-with-aggregation-pipeline.html">Updates with Aggregation Pipeline</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/update-methods.html">Update Methods</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/remove-documents.html">Delete Documents</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/delete-methods.html">Delete Methods</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/bulk-write-operations.html">Bulk Write Operations</a></li><li class="toctree-l2"><a class="reference internal" href="../core/retryable-writes.html">Retryable Writes</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/sql-comparison.html">SQL to MongoDB Mapping Chart</a></li><li class="toctree-l2"><a class="reference internal" href="../text-search.html">Text Search</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/link-text-indexes.html">Text Indexes</a></li><li class="toctree-l3"><a class="reference internal" href="../core/text-search-operators.html">Text Search Operators</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/text-search-in-aggregation.html">Text Search in the Aggregation Pipeline</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/text-search-languages.html">Text Search Languages</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../geospatial-queries.html">Geospatial Queries</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/geospatial-tutorial.html">Find Restaurants with Geospatial Queries</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/geojson.html">GeoJSON Objects</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/read-concern.html">Read Isolation (Read Concern)</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-local.html">Read Concern <code class="docutils literal"><span class="pre">&quot;local&quot;</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-available.html">Read Concern <code class="docutils literal"><span class="pre">&quot;available&quot;</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-majority.html">Read Concern <code class="docutils literal"><span class="pre">&quot;majority&quot;</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-linearizable.html">Read Concern <code class="docutils literal"><span class="pre">&quot;linearizable&quot;</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/read-concern-snapshot.html">Read Concern <code class="docutils literal"><span class="pre">&quot;snapshot&quot;</span></code></a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/write-concern.html">Write Acknowledgement (Write Concern)</a></li><li class="toctree-l2"><a class="reference internal" href="../core/crud.html">MongoDB CRUD Concepts</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/write-operations-atomicity.html">Atomicity and Transactions</a></li><li class="toctree-l3"><a class="reference internal" href="../core/read-isolation-consistency-recency.html">Read Isolation, Consistency, and Recency</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/causal-consistency-read-write-concerns.html">Causal Consistency and Read and Write Concerns</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/distributed-queries.html">Distributed Queries</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/perform-findAndModify-linearizable-reads.html">Linearizable Reads via <code class="docutils literal"><span class="pre">findAndModify</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../core/query-plans.html">Query Plans</a></li><li class="toctree-l3"><a class="reference internal" href="../core/query-optimization.html">Query Optimization</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/evaluate-operation-performance.html">Evaluate Performance of Current Operations</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/optimize-query-performance-with-indexes-and-projections.html">Optimize Query Performance</a></li><li class="toctree-l4"><a class="reference internal" href="../core/write-performance.html">Write Operation Performance</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/explain-results.html">Explain Results</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/analyze-query-plan.html">Analyze Query Performance</a></li><li class="toctree-l3"><a class="reference internal" href="../core/tailable-cursors.html">Tailable Cursors</a></li></ul></li></ul></li><li class="toctree-l1 current"><a class="reference internal" href="../aggregation.html">Aggregation</a><ul class="current"><li class="toctree-l2"><a class="reference internal" href="../core/aggregation-pipeline.html">Aggregation Pipeline</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/aggregation-pipeline-optimization.html">Aggregation Pipeline Optimization</a></li><li class="toctree-l3"><a class="reference internal" href="../core/aggregation-pipeline-limits.html">Aggregation Pipeline Limits</a></li><li class="toctree-l3"><a class="reference internal" href="../core/aggregation-pipeline-sharded-collections.html">Aggregation Pipeline and Sharded Collections</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/aggregation-zip-code-data-set.html">Example with ZIP Code Data</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/aggregation-with-user-preference-data.html">Example with User Preference Data</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/map-reduce.html">Map-Reduce</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/map-reduce-sharded-collections.html">Map-Reduce and Sharded Collections</a></li><li class="toctree-l3"><a class="reference internal" href="../core/map-reduce-concurrency.html">Map-Reduce Concurrency</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/map-reduce-examples.html">Map-Reduce Examples</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/perform-incremental-map-reduce.html">Perform Incremental Map-Reduce</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/troubleshoot-map-function.html">Troubleshoot the Map Function</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/troubleshoot-reduce-function.html">Troubleshoot the Reduce Function</a></li></ul></li><li class="toctree-l2 current"><a class="reference internal" href="../reference/aggregation.html">Aggregation Reference</a><ul class="current"><li class="toctree-l3 current"><a class="reference internal current" href="">Aggregation Pipeline Quick Reference</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/aggregation/interface.html">Aggregation Commands</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/aggregation-commands-comparison.html">Aggregation Commands Comparison</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/aggregation-variables.html">Variables in Aggregation Expressions</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/sql-aggregation-comparison.html">SQL to Aggregation Mapping Chart</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../data-modeling.html">Data Models</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/data-modeling-introduction.html">Data Modeling Introduction</a></li><li class="toctree-l2"><a class="reference internal" href="../core/schema-validation.html">Schema Validation</a></li><li class="toctree-l2"><a class="reference internal" href="../core/data-models.html">Data Modeling Concepts</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/data-model-design.html">Data Model Design</a></li><li class="toctree-l3"><a class="reference internal" href="../core/data-model-operations.html">Operational Factors and Data Models</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../applications/data-models.html">Data Model Examples and Patterns</a><ul><li class="toctree-l3"><a class="reference internal" href="../applications/data-models-relationships.html">Model Relationships Between Documents</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-embedded-one-to-one-relationships-between-documents.html">Model One-to-One Relationships with Embedded Documents</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-embedded-one-to-many-relationships-between-documents.html">Model One-to-Many Relationships with Embedded Documents</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-referenced-one-to-many-relationships-between-documents.html">Model One-to-Many Relationships with Document References</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../applications/data-models-tree-structures.html">Model Tree Structures</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-tree-structures-with-parent-references.html">Model Tree Structures with Parent References</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-tree-structures-with-child-references.html">Model Tree Structures with Child References</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-tree-structures-with-ancestors-array.html">Model Tree Structures with an Array of Ancestors</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-tree-structures-with-materialized-paths.html">Model Tree Structures with Materialized Paths</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-tree-structures-with-nested-sets.html">Model Tree Structures with Nested Sets</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../applications/data-models-applications.html">Model Specific Application Contexts</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-data-for-atomic-operations.html">Model Data for Atomic Operations</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-data-for-keyword-search.html">Model Data to Support Keyword Search</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-data-for-schema-versioning.html">Model Data for Schema Versioning</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-monetary-data.html">Model Monetary Data</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-time-data.html">Model Time Data</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/model-computed-data.html">Model Computed Data</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/data-models.html">Data Model Reference</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/database-references.html">Database References</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../core/transactions.html">Transactions</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/transactions-in-applications.html">Drivers API</a></li><li class="toctree-l2"><a class="reference internal" href="../core/transactions-production-consideration.html">Production Considerations</a></li><li class="toctree-l2"><a class="reference internal" href="../core/transactions-sharded-clusters.html">Production Considerations (Sharded Clusters)</a></li><li class="toctree-l2"><a class="reference internal" href="../core/transactions-operations.html">Transactions and Operations</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../indexes.html">Indexes</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/index-single.html">Single Field Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="../core/index-compound.html">Compound Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="../core/index-multikey.html">Multikey Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/multikey-index-bounds.html">Multikey Index Bounds</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-text.html">Text Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/specify-language-for-text-index.html">Specify a Language for Text Index</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/avoid-text-index-name-limit.html">Specify Name for <code class="docutils literal"><span class="pre">text</span></code> Index</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/control-results-of-text-search.html">Control Search Results with Weights</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/limit-number-of-items-scanned-for-text-search.html">Limit the Number of Entries Scanned</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-wildcard.html">Wildcard Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/index-wildcard-restrictions.html">Wildcard Index Restrictions</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/2dsphere.html"><code class="docutils literal"><span class="pre">2dsphere</span></code> Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/query-a-2dsphere-index.html">Query a <code class="docutils literal"><span class="pre">2dsphere</span></code> Index</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/2d.html"><code class="docutils literal"><span class="pre">2d</span></code> Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/build-a-2d-index.html">Create a <code class="docutils literal"><span class="pre">2d</span></code> Index</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/query-a-2d-index.html">Query a <code class="docutils literal"><span class="pre">2d</span></code> Index</a></li><li class="toctree-l3"><a class="reference internal" href="../core/geospatial-indexes.html"><code class="docutils literal"><span class="pre">2d</span></code> Index Internals</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/calculate-distances-using-spherical-geometry-with-2d-geospatial-indexes.html">Calculate Distance Using Spherical Geometry</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/geohaystack.html"><code class="docutils literal"><span class="pre">geoHaystack</span></code> Indexes</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/build-a-geohaystack-index.html">Create a Haystack Index</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/query-a-geohaystack-index.html">Query a Haystack Index</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-hashed.html">Hashed Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="../core/index-properties.html">Index Properties</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/index-ttl.html">TTL Indexes</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/expire-data.html">Expire Data from Collections by Setting TTL</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/index-unique.html">Unique Indexes</a></li><li class="toctree-l3"><a class="reference internal" href="../core/index-partial.html">Partial Indexes</a></li><li class="toctree-l3"><a class="reference internal" href="../core/index-case-insensitive.html">Case Insensitive Indexes</a></li><li class="toctree-l3"><a class="reference internal" href="../core/index-sparse.html">Sparse Indexes</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-creation.html">Index Builds on Populated Collections</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/build-indexes-on-replica-sets.html">Build Indexes on Replica Sets</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/build-indexes-on-sharded-clusters.html">Build Indexes on Sharded Clusters</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/index-intersection.html">Index Intersection</a></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/manage-indexes.html">Manage Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/measure-index-use.html">Measure Index Use</a></li><li class="toctree-l2"><a class="reference internal" href="../applications/indexes.html">Indexing Strategies</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/create-indexes-to-support-queries.html">Create Indexes to Support Your Queries</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/sort-results-with-indexes.html">Use Indexes to Sort Query Results</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/ensure-indexes-fit-ram.html">Ensure Indexes Fit in RAM</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/create-queries-that-ensure-selectivity.html">Create Queries that Ensure Selectivity</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/indexes.html">Indexing Reference</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../security.html">Security</a><ul><li class="toctree-l2"><a class="reference internal" href="../administration/security-checklist.html">Security Checklist</a></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/enable-authentication.html">Enable Access Control</a></li><li class="toctree-l2"><a class="reference internal" href="../core/authentication.html">Authentication</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/security-users.html">Users</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/create-users.html">Add Users</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/authentication-mechanisms.html">Authentication Mechanisms</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/security-scram.html">SCRAM</a></li><li class="toctree-l4"><a class="reference internal" href="../core/security-x.509.html">x.509</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/configure-x509-client-authentication.html">Use x.509 Certificates to Authenticate Clients</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/authentication-mechanisms-enterprise.html">Enterprise Authentication Mechanisms</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/kerberos.html">Kerberos Authentication</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/control-access-to-mongodb-with-kerberos-authentication.html">Configure MongoDB with Kerberos Authentication on Linux</a></li><li class="toctree-l5"><a class="reference internal" href="../tutorial/control-access-to-mongodb-windows-with-kerberos-authentication.html">Configure MongoDB with Kerberos Authentication on Windows</a></li><li class="toctree-l5"><a class="reference internal" href="../tutorial/troubleshoot-kerberos.html">Troubleshoot Kerberos Authentication</a></li><li class="toctree-l5"><a class="reference internal" href="../tutorial/kerberos-auth-activedirectory-authz.html">Configure MongoDB with Kerberos Authentication and Active Directory Authorization</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../core/security-ldap.html">LDAP Proxy Authentication</a><ul><li class="toctree-l5"><a class="reference internal" href="../tutorial/configure-ldap-sasl-activedirectory.html">Authenticate Using SASL and LDAP with ActiveDirectory</a></li><li class="toctree-l5"><a class="reference internal" href="../tutorial/configure-ldap-sasl-openldap.html">Authenticate Using SASL and LDAP with OpenLDAP</a></li><li class="toctree-l5"><a class="reference internal" href="../tutorial/authenticate-nativeldap-activedirectory.html">Authenticate and Authorize Users Using Active Directory via Native LDAP</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../core/security-ldap-external.html">LDAP Authorization</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/security-internal-authentication.html">Internal/Membership Authentication</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/deploy-replica-set-with-keyfile-access-control.html">Deploy Replica Set With Keyfile Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/enforce-keyfile-access-control-in-existing-replica-set.html">Update Replica Set to Keyfile Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/enforce-keyfile-access-control-in-existing-replica-set-without-downtime.html">Update Replica Set to Keyfile Authentication (No Downtime)</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/rotate-key-replica-set.html">Rotate Keys for Replica Sets</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/deploy-sharded-cluster-with-keyfile-access-control.html">Deploy Sharded Cluster with Keyfile Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/enforce-keyfile-access-control-in-existing-sharded-cluster.html">Update Sharded Cluster to Keyfile Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/enforce-keyfile-access-control-in-existing-sharded-cluster-no-downtime.html">Update Sharded Cluster to Keyfile Authentication (No Downtime)</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/rotate-key-sharded-cluster.html">Rotate Keys for Sharded Clusters</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/configure-x509-member-authentication.html">Use x.509 Certificate for Membership Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/upgrade-keyfile-to-x509.html">Upgrade from Keyfile Authentication to x.509 Authentication</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/rotate-x509-membership-certificates.html">Rolling Update of x.509 Cluster Certificates that Contain New DN</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/authorization.html">Role-Based Access Control</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/built-in-roles.html">Built-In Roles</a></li><li class="toctree-l3"><a class="reference internal" href="../core/security-user-defined-roles.html">User-Defined Roles</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/manage-users-and-roles.html">Manage Users and Roles</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/change-own-password-and-custom-data.html">Change Your Password and Custom Data</a></li><li class="toctree-l3"><a class="reference internal" href="../core/collection-level-access-control.html">Collection-Level Access Control</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/security-transport-encryption.html">TLS/SSL (Transport Encryption)</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-ssl.html">Configure <code class="docutils literal"><span class="pre">mongod</span></code> and <code class="docutils literal"><span class="pre">mongos</span></code> for TLS/SSL</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-ssl-clients.html">TLS/SSL Configuration for Clients</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/upgrade-cluster-to-ssl.html">Upgrade a Cluster to Use TLS/SSL</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-fips.html">Configure MongoDB for FIPS</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/security-encryption-at-rest.html">Encryption at Rest</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-encryption.html">Configure Encryption</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/rotate-encryption-key.html">Rotate Encryption Keys</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/security-client-side-encryption.html">Client-Side Field Level Encryption</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/security-automatic-client-side-encryption.html">Automatic Client-Side Field Level Encryption</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/security-client-side-automatic-json-schema.html">Automatic Encryption Rules</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/security-client-side-query-aggregation-support.html">Read/Write Support with Automatic Field Level Encryption</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/security-client-side-encryption-appendix.html">Appendix</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/security-explicit-client-side-encryption.html">Explicit (Manual) Client-Side Field Level Encryption</a></li><li class="toctree-l3"><a class="reference internal" href="../core/security-client-side-encryption-key-management.html">Master Key and Data Encryption Key Management</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/manage-client-side-encryption-data-keys.html">Manage Data Encryption Keys</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/security-client-side-encryption-limitations.html">Limitations</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/auditing.html">Auditing</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-auditing.html">Configure Auditing</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-audit-filters.html">Configure Audit Filters</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/audit-message.html">System Event Audit Messages</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/security-hardening.html">Network and Configuration Hardening</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/security-mongodb-configuration.html">IP Binding</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-linux-iptables-firewall.html">Configure Linux <code class="docutils literal"><span class="pre">iptables</span></code> Firewall for MongoDB</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-windows-netsh-firewall.html">Configure Windows <code class="docutils literal"><span class="pre">netsh</span></code> Firewall for MongoDB</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/implement-field-level-redaction.html">Implement Field Level Redaction</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/security.html">Security Reference</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/system-roles-collection.html"><code class="docutils literal"><span class="pre">system.roles</span></code> Collection</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/system-users-collection.html"><code class="docutils literal"><span class="pre">system.users</span></code> Collection</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/resource-document.html">Resource Document</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/privilege-actions.html">Privilege Actions</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/create-a-vulnerability-report.html">Create a Vulnerability Report</a></li><li class="toctree-l2"><a class="reference internal" href="../appendix/security.html">Appendix</a><ul><li class="toctree-l3"><a class="reference internal" href="../appendix/security/appendixA-openssl-ca.html">Appendix A - OpenSSL CA Certificate for Testing</a></li><li class="toctree-l3"><a class="reference internal" href="../appendix/security/appendixB-openssl-server.html">Appendix B - OpenSSL Server Certificates for Testing</a></li><li class="toctree-l3"><a class="reference internal" href="../appendix/security/appendixC-openssl-client.html">Appendix C - OpenSSL Client Certificates for Testing</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../changeStreams.html">Change Streams</a><ul><li class="toctree-l2"><a class="reference internal" href="../administration/change-streams-production-recommendations.html">Change Streams Production Recommendations</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/change-events.html">Change Events</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../replication.html">Replication</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-members.html">Replica Set Members</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-primary.html">Replica Set Primary</a></li><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-secondary.html">Replica Set Secondary Members</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/replica-set-priority-0-member.html">Priority 0 Replica Set Members</a></li><li class="toctree-l4"><a class="reference internal" href="../core/replica-set-hidden-member.html">Hidden Replica Set Members</a></li><li class="toctree-l4"><a class="reference internal" href="../core/replica-set-delayed-member.html">Delayed Replica Set Members</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-arbiter.html">Replica Set Arbiter</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-oplog.html">Replica Set Oplog</a></li><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-sync.html">Replica Set Data Synchronization</a></li><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-architectures.html">Replica Set Deployment Architectures</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-architecture-three-members.html">Three Member Replica Sets</a></li><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-architecture-geographically-distributed.html">Replica Sets Distributed Across Two or More Data Centers</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/replica-set-high-availability.html">Replica Set High Availability</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-elections.html">Replica Set Elections</a></li><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-rollbacks.html">Rollbacks During Replica Set Failover</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../applications/replication.html">Replica Set Read and Write Semantics</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/replica-set-write-concern.html">Write Concern for Replica Sets</a></li><li class="toctree-l3"><a class="reference internal" href="../core/read-preference.html">Read Preference</a><ul><li class="toctree-l4"><a class="reference internal" href="../core/read-preference-tags.html">Tag Sets</a></li><li class="toctree-l4"><a class="reference internal" href="../core/read-preference-staleness.html">maxStalenessSeconds</a></li><li class="toctree-l4"><a class="reference internal" href="../core/read-preference-use-cases.html">Read Preference Use Cases</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/read-preference-mechanics.html">Server Selection Algorithm</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/replica-set-deployment.html">Replica Set Deployment Tutorials</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/deploy-replica-set.html">Deploy a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/deploy-replica-set-for-testing.html">Deploy a Replica Set for Testing and Development</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/deploy-geographically-distributed-replica-set.html">Deploy a Geographically Redundant Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/add-replica-set-arbiter.html">Add an Arbiter to Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/convert-standalone-to-replica-set.html">Convert a Standalone to a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/expand-replica-set.html">Add Members to a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/remove-replica-set-member.html">Remove Members from Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/replace-replica-set-member.html">Replace a Replica Set Member</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/replica-set-member-configuration.html">Member Configuration Tutorials</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/adjust-replica-set-member-priority.html">Adjust Priority for Replica Set Member</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-secondary-only-replica-set-member.html">Prevent Secondary from Becoming Primary</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-a-hidden-replica-set-member.html">Configure a Hidden Replica Set Member</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-a-delayed-replica-set-member.html">Configure a Delayed Replica Set Member</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-a-non-voting-replica-set-member.html">Configure Non-Voting Replica Set Member</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/convert-secondary-into-arbiter.html">Convert a Secondary to an Arbiter</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/replica-set-maintenance.html">Replica Set Maintenance Tutorials</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/change-oplog-size.html">Change the Size of the Oplog</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/perform-maintence-on-replica-set-members.html">Perform Maintenance on Replica Set Members</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/force-member-to-be-primary.html">Force a Member to Become Primary</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/resync-replica-set-member.html">Resync a Member of a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-replica-set-tag-sets.html">Configure Replica Set Tag Sets</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/reconfigure-replica-set-with-unavailable-members.html">Reconfigure a Replica Set with Unavailable Members</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/manage-chained-replication.html">Manage Chained Replication</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/change-hostnames-in-a-replica-set.html">Change Hostnames in a Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/configure-replica-set-secondary-sync-target.html">Configure a Secondary’s Sync Target</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/replication.html">Replication Reference</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/replica-configuration.html">Replica Set Configuration</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/replica-set-protocol-versions.html">Replica Set Protocol Version</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/troubleshoot-replica-sets.html">Troubleshoot Replica Sets</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/local-database.html">The <code class="docutils literal"><span class="pre">local</span></code> Database</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/replica-states.html">Replica Set Member States</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../sharding.html">Sharding</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/sharded-cluster-components.html">Sharded Cluster Components</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/sharded-cluster-shards.html">Shards</a></li><li class="toctree-l3"><a class="reference internal" href="../core/sharded-cluster-config-servers.html">Config Servers (metadata)</a></li><li class="toctree-l3"><a class="reference internal" href="../core/sharded-cluster-query-router.html">Router (mongos)</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/sharding-shard-key.html">Shard Keys</a></li><li class="toctree-l2"><a class="reference internal" href="../core/hashed-sharding.html">Hashed Sharding</a></li><li class="toctree-l2"><a class="reference internal" href="../core/ranged-sharding.html">Ranged Sharding</a></li><li class="toctree-l2"><a class="reference internal" href="../tutorial/deploy-shard-cluster.html">Deploy a Sharded Cluster</a></li><li class="toctree-l2"><a class="reference internal" href="../core/zone-sharding.html">Zones</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/manage-shard-zone.html">Manage Shard Zones</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/sharding-segmenting-data-by-location.html">Segmenting Data by Location</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/sharding-tiered-hardware-for-varying-slas.html">Tiered Hardware for Varying SLA or SLO</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/sharding-segmenting-shards.html">Segmenting Data by Application or Customer</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/sharding-high-availability-writes.html">Distributed Local Writes for Insert Only Workloads</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/sharding-data-partitioning.html">Data Partitioning with Chunks</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/create-chunks-in-sharded-cluster.html">Create Chunks in a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/split-chunks-in-sharded-cluster.html">Split Chunks in a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/merge-chunks-in-sharded-cluster.html">Merge Chunks in a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/modify-chunk-size-in-sharded-cluster.html">Modify Chunk Size in a Sharded Cluster</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/sharding-balancer-administration.html">Balancer</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/manage-sharded-cluster-balancer.html">Manage Sharded Cluster Balancer</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/migrate-chunks-in-sharded-cluster.html">Migrate Chunks in a Sharded Cluster</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/sharded-cluster-administration.html">Administration</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/sharded-cluster-config-servers.html">Config Server Administration</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/replace-config-server.html">Replace a Config Server</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/view-sharded-cluster-configuration.html">View Cluster Configuration</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/restart-sharded-cluster.html">Restart a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/migrate-sharded-cluster-to-new-hardware.html">Migrate a Sharded Cluster to Different Hardware</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/add-shards-to-shard-cluster.html">Add Shards to a Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/remove-shards-from-cluster.html">Remove Shards from an Existing Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/clear-jumbo-flag.html">Clear <code class="docutils literal"><span class="pre">jumbo</span></code> Flag</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/backup-sharded-cluster-metadata.html">Back Up Cluster Metadata</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/convert-sharded-cluster-to-replica-set.html">Convert Sharded Cluster to Replica Set</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/convert-replica-set-to-replicated-shard-cluster.html">Convert a Replica Set to a Sharded Cluster</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/convert-shard-standalone-to-shard-replica-set.html">Convert a Shard Standalone to a Shard Replica Set</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/sharding.html">Sharding Reference</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/sharded-cluster-requirements.html">Operational Restrictions</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/troubleshoot-sharded-clusters.html">Troubleshoot Sharded Clusters</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/config-database.html">Config Database</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../administration.html">Administration</a><ul><li class="toctree-l2"><a class="reference internal" href="../administration/production-notes.html">Production Notes</a></li><li class="toctree-l2"><a class="reference internal" href="../administration/production-checklist-operations.html">Operations Checklist</a></li><li class="toctree-l2"><a class="reference internal" href="../administration/production-checklist-development.html">Development Checklist</a></li><li class="toctree-l2"><a class="reference internal" href="../administration/analyzing-mongodb-performance.html">Performance</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/manage-the-database-profiler.html">Database Profiler</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/database-profiler.html">Database Profiler Output</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/transparent-huge-pages.html">Disable Transparent Huge Pages (THP)</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/ulimit.html">UNIX <code class="docutils literal"><span class="pre">ulimit</span></code> Settings</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/configuration-and-maintenance.html">Configuration and Maintenance</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/configuration.html">Run-time Database Configuration</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/upgrade-revision.html">Upgrade to the Latest Revision of MongoDB</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/manage-mongodb-processes.html">Manage <code class="docutils literal"><span class="pre">mongod</span></code> Processes</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/terminate-running-operations.html">Terminate Running Operations</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/rotate-log-files.html">Rotate Log Files</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../data-center-awareness.html">Data Center Awareness</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/workload-isolation.html">Workload Isolation in MongoDB Deployments</a></li><li class="toctree-l3"><a class="reference internal" href="../core/zone-sharding.html">Zones</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/manage-shard-zone.html">Manage Shard Zones</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/sharding-segmenting-data-by-location.html">Segmenting Data by Location</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/sharding-tiered-hardware-for-varying-slas.html">Tiered Hardware for Varying SLA or SLO</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/sharding-segmenting-shards.html">Segmenting Data by Application or Customer</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/sharding-high-availability-writes.html">Distributed Local Writes for Insert Only Workloads</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/manage-shard-zone.html">Manage Shard Zones</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/backups.html">MongoDB Backup Methods</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/backup-with-filesystem-snapshots.html">Back Up and Restore with Filesystem Snapshots</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/backup-and-restore-tools.html">Back Up and Restore with MongoDB Tools</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/restore-replica-set-from-backup.html">Restore a Replica Set from MongoDB Backups</a></li><li class="toctree-l3"><a class="reference internal" href="../administration/backup-sharded-clusters.html">Backup and Restore Sharded Clusters</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/backup-sharded-cluster-with-filesystem-snapshots.html">Back Up a Sharded Cluster with File System Snapshots</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/backup-sharded-cluster-with-database-dumps.html">Back Up a Sharded Cluster with Database Dumps</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/schedule-backup-window-for-sharded-clusters.html">Schedule Backup Window for Sharded Clusters</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/restore-sharded-cluster.html">Restore a Sharded Cluster</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/recover-data-following-unexpected-shutdown.html">Recover a Standalone after an Unexpected Shutdown</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../administration/monitoring.html">Monitoring for MongoDB</a><ul><li class="toctree-l3"><a class="reference internal" href="../administration/free-monitoring.html">Free Monitoring</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/monitor-with-snmp.html">Monitor MongoDB With SNMP on Linux</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/monitor-with-snmp-on-windows.html">Monitor MongoDB Windows with SNMP</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/troubleshoot-snmp.html">Troubleshoot SNMP</a></li></ul></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../storage.html">Storage</a><ul><li class="toctree-l2"><a class="reference internal" href="../core/storage-engines.html">Storage Engines</a><ul><li class="toctree-l3"><a class="reference internal" href="../core/wiredtiger.html">WiredTiger Storage Engine</a><ul><li class="toctree-l4"><a class="reference internal" href="../tutorial/change-standalone-wiredtiger.html">Change Standalone to WiredTiger</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/change-replica-set-wiredtiger.html">Change Replica Set to WiredTiger</a></li><li class="toctree-l4"><a class="reference internal" href="../tutorial/change-sharded-cluster-wiredtiger.html">Change Sharded Cluster to WiredTiger</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../core/inmemory.html">In-Memory Storage Engine</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/journaling.html">Journaling</a><ul><li class="toctree-l3"><a class="reference internal" href="../tutorial/manage-journaling.html">Manage Journaling</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../core/gridfs.html">GridFS</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/storage.html">FAQ: MongoDB Storage</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../faq.html">Frequently Asked Questions</a><ul><li class="toctree-l2"><a class="reference internal" href="../faq/fundamentals.html">FAQ: MongoDB Fundamentals</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/indexes.html">FAQ: Indexes</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/concurrency.html">FAQ: Concurrency</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/sharding.html">FAQ: Sharding with MongoDB</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/replica-sets.html">FAQ: Replication and Replica Sets</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/storage.html">FAQ: MongoDB Storage</a></li><li class="toctree-l2"><a class="reference internal" href="../faq/diagnostics.html">FAQ: MongoDB Diagnostics</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../reference.html">Reference</a><ul><li class="toctree-l2"><a class="reference internal" href="../reference/operator.html">Operators</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/operator/query.html">Query and Projection Operators</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-comparison.html">Comparison Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/eq.html">$eq</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/gt.html">$gt</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/gte.html">$gte</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/in.html">$in</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/lt.html">$lt</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/lte.html">$lte</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/ne.html">$ne</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/nin.html">$nin</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-logical.html">Logical Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/and.html">$and</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/not.html">$not</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/nor.html">$nor</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/or.html">$or</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-element.html">Element Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/exists.html">$exists</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/type.html">$type</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-evaluation.html">Evaluation Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/expr.html">$expr</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/jsonSchema.html">$jsonSchema</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/mod.html">$mod</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/regex.html">$regex</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/text.html">$text</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/where.html">$where</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-geospatial.html">Geospatial Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/geoIntersects.html">$geoIntersects</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/geoWithin.html">$geoWithin</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/near.html">$near</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/nearSphere.html">$nearSphere</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/box.html">$box</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/center.html">$center</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/centerSphere.html">$centerSphere</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/geometry.html">$geometry</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/maxDistance.html">$maxDistance</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/minDistance.html">$minDistance</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/polygon.html">$polygon</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/uniqueDocs.html">$uniqueDocs</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-array.html">Array Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/all.html">$all</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/elemMatch.html">$elemMatch (query)</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/size.html">$size</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query-bitwise.html">Bitwise Query Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/bitsAllClear.html">$bitsAllClear</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/bitsAllSet.html">$bitsAllSet</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/bitsAnyClear.html">$bitsAnyClear</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/query/bitsAnySet.html">$bitsAnySet</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/query/comment.html">$comment</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/projection.html">Projection Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/projection/positional.html">$ (projection)</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/projection/elemMatch.html">$elemMatch (projection)</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/projection/meta.html">$meta</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/projection/slice.html">$slice (projection)</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/update.html">Update Operators</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/update-field.html">Field Update Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/currentDate.html">$currentDate</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/inc.html">$inc</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/min.html">$min</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/max.html">$max</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/mul.html">$mul</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/rename.html">$rename</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/set.html">$set</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/setOnInsert.html">$setOnInsert</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/unset.html">$unset</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/update-array.html">Array Update Operators</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/positional.html">$ (update)</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/positional-all.html">$[]</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/positional-filtered.html">$[&lt;identifier&gt;]</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/addToSet.html">$addToSet</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/pop.html">$pop</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/pull.html">$pull</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/push.html">$push</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/pullAll.html">$pullAll</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/each.html">$each</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/position.html">$position</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/slice.html">$slice</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/sort.html">$sort</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/update-bitwise.html">Bitwise Update Operator</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/operator/update/bit.html">$bit</a></li></ul></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/aggregation-pipeline.html">Aggregation Pipeline Stages</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/addFields.html">$addFields (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/bucket.html">$bucket (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/bucketAuto.html">$bucketAuto (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/collStats.html">$collStats (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/count.html">$count (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/currentOp.html">$currentOp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/facet.html">$facet (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/geoNear.html">$geoNear (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/graphLookup.html">$graphLookup (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/group.html">$group (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/indexStats.html">$indexStats (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/limit.html">$limit (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/listLocalSessions.html">$listLocalSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/listSessions.html">$listSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/lookup.html">$lookup (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/match.html">$match (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/merge.html">$merge (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/out.html">$out (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/planCacheStats.html">$planCacheStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/project.html">$project (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/redact.html">$redact (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/replaceRoot.html">$replaceRoot (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/replaceWith.html">$replaceWith (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sample.html">$sample (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/set.html">$set (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/skip.html">$skip (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sort.html">$sort (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sortByCount.html">$sortByCount (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/unset.html">$unset (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/unwind.html">$unwind (aggregation)</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/aggregation.html">Aggregation Pipeline Operators</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/abs.html">$abs (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/acos.html">$acos (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/acosh.html">$acosh (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/add.html">$add (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/addToSet.html">$addToSet (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/allElementsTrue.html">$allElementsTrue (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/and.html">$and (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/anyElementTrue.html">$anyElementTrue (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/arrayElemAt.html">$arrayElemAt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/arrayToObject.html">$arrayToObject (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/asin.html">$asin (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/asinh.html">$asinh (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/atan.html">$atan (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/atan2.html">$atan2 (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/atanh.html">$atanh (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/avg.html">$avg (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ceil.html">$ceil (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/cmp.html">$cmp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/concat.html">$concat (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/concatArrays.html">$concatArrays (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/cond.html">$cond (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/convert.html">$convert (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/cos.html">$cos (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dateFromParts.html">$dateFromParts (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dateToParts.html">$dateToParts (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dateFromString.html">$dateFromString (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dateToString.html">$dateToString (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dayOfMonth.html">$dayOfMonth (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dayOfWeek.html">$dayOfWeek (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/dayOfYear.html">$dayOfYear (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/degreesToRadians.html">$degreesToRadians (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/divide.html">$divide (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/eq.html">$eq (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/exp.html">$exp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/filter.html">$filter (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/first.html">$first (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/floor.html">$floor (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/gt.html">$gt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/gte.html">$gte (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/hour.html">$hour (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ifNull.html">$ifNull (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/in.html">$in (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/indexOfArray.html">$indexOfArray (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/indexOfBytes.html">$indexOfBytes (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/indexOfCP.html">$indexOfCP (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/isArray.html">$isArray (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/isoDayOfWeek.html">$isoDayOfWeek (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/isoWeek.html">$isoWeek (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/isoWeekYear.html">$isoWeekYear (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/last.html">$last (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/let.html">$let (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/literal.html">$literal (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ln.html">$ln (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/log.html">$log (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/log10.html">$log10 (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/lt.html">$lt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/lte.html">$lte (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ltrim.html">$ltrim (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/map.html">$map (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/max.html">$max (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/mergeObjects.html">$mergeObjects (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/meta.html">$meta (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/min.html">$min (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/millisecond.html">$millisecond (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/minute.html">$minute (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/mod.html">$mod (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/month.html">$month (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/multiply.html">$multiply (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/ne.html">$ne (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/not.html">$not (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/objectToArray.html">$objectToArray (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/or.html">$or (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/pow.html">$pow (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/push.html">$push (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/radiansToDegrees.html">$radiansToDegrees (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/range.html">$range (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/reduce.html">$reduce (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/regexFind.html">$regexFind (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/regexFindAll.html">$regexFindAll (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/regexMatch.html">$regexMatch (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/reverseArray.html">$reverseArray (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/round.html">$round (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/rtrim.html">$rtrim (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/second.html">$second (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setDifference.html">$setDifference (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setEquals.html">$setEquals (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setIntersection.html">$setIntersection (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setIsSubset.html">$setIsSubset (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/setUnion.html">$setUnion (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/size.html">$size (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sin.html">$sin (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/slice.html">$slice (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/split.html">$split (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sqrt.html">$sqrt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/stdDevPop.html">$stdDevPop (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/stdDevSamp.html">$stdDevSamp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/strcasecmp.html">$strcasecmp (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/strLenBytes.html">$strLenBytes (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/strLenCP.html">$strLenCP (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/substr.html">$substr (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/substrBytes.html">$substrBytes (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/substrCP.html">$substrCP (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/subtract.html">$subtract (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/sum.html">$sum (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/switch.html">$switch (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/tan.html">$tan (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toBool.html">$toBool (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toDate.html">$toDate (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toDecimal.html">$toDecimal (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toDouble.html">$toDouble(aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toInt.html">$toInt (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toLong.html">$toLong (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toObjectId.html">$toObjectId (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toString.html">$toString (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toLower.html">$toLower (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/toUpper.html">$toUpper (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/trim.html">$trim (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/trunc.html">$trunc (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/type.html">$type (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/week.html">$week (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/year.html">$year (aggregation)</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/aggregation/zip.html">$zip (aggregation)</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/operator/query-modifier.html">Query Modifiers</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/comment.html">$comment</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/explain.html">$explain</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/hint.html">$hint</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/max.html">$max</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/maxTimeMS.html">$maxTimeMS</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/min.html">$min</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/orderby.html">$orderby</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/query.html">$query</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/returnKey.html">$returnKey</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/showDiskLoc.html">$showDiskLoc</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/operator/meta/natural.html">$natural</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/command.html">Database Commands</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-aggregation.html">Aggregation Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/aggregate.html">aggregate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/count.html">count</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/distinct.html">distinct</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/mapReduce.html">mapReduce</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-geospatial.html">Geospatial Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/geoSearch.html">geoSearch</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-crud.html">Query and Write Operation Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/delete.html">delete</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/find.html">find</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/findAndModify.html">findAndModify</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getLastError.html">getLastError</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getMore.html">getMore</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/insert.html">insert</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/resetError.html">resetError</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/update.html">update</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-plan-cache.html">Query Plan Cache Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheClear.html">planCacheClear</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheClearFilters.html">planCacheClearFilters</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheListFilters.html">planCacheListFilters</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheListPlans.html">planCacheListPlans</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheListQueryShapes.html">planCacheListQueryShapes</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/planCacheSetFilter.html">planCacheSetFilter</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-authentication.html">Authentication Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/authenticate.html">authenticate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getnonce.html">getnonce</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/logout.html">logout</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-user-management.html">User Management Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/createUser.html">createUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropAllUsersFromDatabase.html">dropAllUsersFromDatabase</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropUser.html">dropUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/grantRolesToUser.html">grantRolesToUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/revokeRolesFromUser.html">revokeRolesFromUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/updateUser.html">updateUser</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/usersInfo.html">usersInfo</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-role-management.html">Role Management Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/createRole.html">createRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropRole.html">dropRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropAllRolesFromDatabase.html">dropAllRolesFromDatabase</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/grantPrivilegesToRole.html">grantPrivilegesToRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/grantRolesToRole.html">grantRolesToRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/invalidateUserCache.html">invalidateUserCache</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/revokePrivilegesFromRole.html">revokePrivilegesFromRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/revokeRolesFromRole.html">revokeRolesFromRole</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/rolesInfo.html">rolesInfo</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/updateRole.html">updateRole</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-replication.html">Replication Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/applyOps.html">applyOps</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/isMaster.html">isMaster</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetAbortPrimaryCatchUp.html">replSetAbortPrimaryCatchUp</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetFreeze.html">replSetFreeze</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetGetConfig.html">replSetGetConfig</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetGetStatus.html">replSetGetStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetInitiate.html">replSetInitiate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetMaintenance.html">replSetMaintenance</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetReconfig.html">replSetReconfig</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetResizeOplog.html">replSetResizeOplog</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetStepDown.html">replSetStepDown</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/replSetSyncFrom.html">replSetSyncFrom</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-sharding.html">Sharding Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/addShard.html">addShard</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/addShardToZone.html">addShardToZone</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/balancerStart.html">balancerStart</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/balancerStatus.html">balancerStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/balancerStop.html">balancerStop</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/checkShardingIndex.html">checkShardingIndex</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/clearJumboFlag.html">clearJumboFlag</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/cleanupOrphaned.html">cleanupOrphaned</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/enableSharding.html">enableSharding</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/flushRouterConfig.html">flushRouterConfig</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getShardMap.html">getShardMap</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getShardVersion.html">getShardVersion</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/isdbgrid.html">isdbgrid</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listShards.html">listShards</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/medianKey.html">medianKey</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/moveChunk.html">moveChunk</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/movePrimary.html">movePrimary</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/mergeChunks.html">mergeChunks</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/removeShard.html">removeShard</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/removeShardFromZone.html">removeShardFromZone</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/setShardVersion.html">setShardVersion</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/shardCollection.html">shardCollection</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/shardingState.html">shardingState</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/split.html">split</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/splitChunk.html">splitChunk</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/splitVector.html">splitVector</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/unsetSharding.html">unsetSharding</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/updateZoneKeyRange.html">updateZoneKeyRange</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-sessions.html">Sessions Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/abortTransaction.html">abortTransaction</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/commitTransaction.html">commitTransaction</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/endSessions.html">endSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killAllSessions.html">killAllSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killAllSessionsByPattern.html">killAllSessionsByPattern</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killSessions.html">killSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/refreshSessions.html">refreshSessions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/startSession.html">startSession</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-administration.html">Administration Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/clean.html">clean</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/cloneCollection.html">cloneCollection</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/cloneCollectionAsCapped.html">cloneCollectionAsCapped</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/collMod.html">collMod</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/compact.html">compact</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/connPoolSync.html">connPoolSync</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/convertToCapped.html">convertToCapped</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/create.html">create</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/createIndexes.html">createIndexes</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/currentOp.html">currentOp</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/drop.html">drop</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropDatabase.html">dropDatabase</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropConnections.html">dropConnections</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dropIndexes.html">dropIndexes</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/filemd5.html">filemd5</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/fsync.html">fsync</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/fsyncUnlock.html">fsyncUnlock</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getParameter.html">getParameter</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killCursors.html">killCursors</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/killOp.html">killOp</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listCollections.html">listCollections</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listDatabases.html">listDatabases</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listIndexes.html">listIndexes</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/logRotate.html">logRotate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/reIndex.html">reIndex</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/renameCollection.html">renameCollection</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/setFeatureCompatibilityVersion.html">setFeatureCompatibilityVersion</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/setParameter.html">setParameter</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/shutdown.html">shutdown</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-diagnostic.html">Diagnostic Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/availableQueryOptions.html">availableQueryOptions</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/buildInfo.html">buildInfo</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/collStats.html">collStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/connPoolStats.html">connPoolStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/connectionStatus.html">connectionStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/cursorInfo.html">cursorInfo</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dataSize.html">dataSize</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dbHash.html">dbHash</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/dbStats.html">dbStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/diagLogging.html">diagLogging</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/driverOIDTest.html">driverOIDTest</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/explain.html">explain</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/features.html">features</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getCmdLineOpts.html">getCmdLineOpts</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/getLog.html">getLog</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/hostInfo.html">hostInfo</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/isSelf.html">isSelf</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/listCommands.html">listCommands</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/netstat.html">netstat</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/ping.html">ping</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/profile.html">profile</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/serverStatus.html">serverStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/shardConnPoolStats.html">shardConnPoolStats</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/top.html">top</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/validate.html">validate</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/whatsmyuri.html">whatsmyuri</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-free-monitoring.html">Free Monitoring Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/getFreeMonitoringStatus.html">getFreeMonitoringStatus</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/command/setFreeMonitoring.html">setFreeMonitoring</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/command/nav-auditing.html">System Events Auditing Commands</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/command/logApplicationMessage.html">logApplicationMessage</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/method.html"><code class="docutils literal"><span class="pre">mongo</span></code> Shell Methods</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-collection.html">Collection Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.aggregate.html">db.collection.aggregate()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.bulkWrite.html">db.collection.bulkWrite()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.copyTo.html">db.collection.copyTo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.count.html">db.collection.count()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.countDocuments.html">db.collection.countDocuments()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.estimatedDocumentCount.html">db.collection.estimatedDocumentCount()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.createIndex.html">db.collection.createIndex()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.createIndexes.html">db.collection.createIndexes()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.dataSize.html">db.collection.dataSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.deleteOne.html">db.collection.deleteOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.deleteMany.html">db.collection.deleteMany()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.distinct.html">db.collection.distinct()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.drop.html">db.collection.drop()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.dropIndex.html">db.collection.dropIndex()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.dropIndexes.html">db.collection.dropIndexes()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.ensureIndex.html">db.collection.ensureIndex()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.explain.html">db.collection.explain()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.find.html">db.collection.find()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findAndModify.html">db.collection.findAndModify()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findOne.html">db.collection.findOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findOneAndDelete.html">db.collection.findOneAndDelete()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findOneAndReplace.html">db.collection.findOneAndReplace()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.findOneAndUpdate.html">db.collection.findOneAndUpdate()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.getIndexes.html">db.collection.getIndexes()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.getShardDistribution.html">db.collection.getShardDistribution()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.getShardVersion.html">db.collection.getShardVersion()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.insert.html">db.collection.insert()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.insertOne.html">db.collection.insertOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.insertMany.html">db.collection.insertMany()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.isCapped.html">db.collection.isCapped()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.latencyStats.html">db.collection.latencyStats()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.mapReduce.html">db.collection.mapReduce()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.reIndex.html">db.collection.reIndex()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.remove.html">db.collection.remove()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.renameCollection.html">db.collection.renameCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.replaceOne.html">db.collection.replaceOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.save.html">db.collection.save()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.stats.html">db.collection.stats()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.storageSize.html">db.collection.storageSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.totalIndexSize.html">db.collection.totalIndexSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.totalSize.html">db.collection.totalSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.update.html">db.collection.update()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.updateOne.html">db.collection.updateOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.updateMany.html">db.collection.updateMany()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.watch.html">db.collection.watch()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.validate.html">db.collection.validate()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-cursor.html">Cursor Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.addOption.html">cursor.addOption()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.allowPartialResults.html">cursor.allowPartialResults()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.batchSize.html">cursor.batchSize()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.close.html">cursor.close()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.isClosed.html">cursor.isClosed()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.collation.html">cursor.collation()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.comment.html">cursor.comment()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.count.html">cursor.count()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.explain.html">cursor.explain()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.forEach.html">cursor.forEach()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.hasNext.html">cursor.hasNext()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.hint.html">cursor.hint()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.isExhausted.html">cursor.isExhausted()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.itcount.html">cursor.itcount()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.limit.html">cursor.limit()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.map.html">cursor.map()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.max.html">cursor.max()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.maxTimeMS.html">cursor.maxTimeMS()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.min.html">cursor.min()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.next.html">cursor.next()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.noCursorTimeout.html">cursor.noCursorTimeout()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.objsLeftInBatch.html">cursor.objsLeftInBatch()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.pretty.html">cursor.pretty()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.readConcern.html">cursor.readConcern()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.readPref.html">cursor.readPref()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.returnKey.html">cursor.returnKey()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.showRecordId.html">cursor.showRecordId()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.size.html">cursor.size()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.skip.html">cursor.skip()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.sort.html">cursor.sort()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.tailable.html">cursor.tailable()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cursor.toArray.html">cursor.toArray()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-database.html">Database Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.adminCommand.html">db.adminCommand()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.aggregate.html">db.aggregate()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.cloneCollection.html">db.cloneCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.cloneDatabase.html">db.cloneDatabase()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.commandHelp.html">db.commandHelp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.copyDatabase.html">db.copyDatabase()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.createCollection.html">db.createCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.createView.html">db.createView()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.currentOp.html">db.currentOp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropDatabase.html">db.dropDatabase()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.eval.html">db.eval()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.fsyncLock.html">db.fsyncLock()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.fsyncUnlock.html">db.fsyncUnlock()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getCollection.html">db.getCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getCollectionInfos.html">db.getCollectionInfos()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getCollectionNames.html">db.getCollectionNames()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getLastError.html">db.getLastError()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getLastErrorObj.html">db.getLastErrorObj()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getLogComponents.html">db.getLogComponents()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getMongo.html">db.getMongo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getName.html">db.getName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getProfilingLevel.html">db.getProfilingLevel()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getProfilingStatus.html">db.getProfilingStatus()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getReplicationInfo.html">db.getReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getSiblingDB.html">db.getSiblingDB()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.help.html">db.help()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.hostInfo.html">db.hostInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.isMaster.html">db.isMaster()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.killOp.html">db.killOp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.listCommands.html">db.listCommands()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.logout.html">db.logout()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.printCollectionStats.html">db.printCollectionStats()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.printReplicationInfo.html">db.printReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.printShardingStatus.html">db.printShardingStatus()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.printSlaveReplicationInfo.html">db.printSlaveReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.resetError.html">db.resetError()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.runCommand.html">db.runCommand()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.serverBuildInfo.html">db.serverBuildInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.serverCmdLineOpts.html">db.serverCmdLineOpts()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.serverStatus.html">db.serverStatus()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.setLogLevel.html">db.setLogLevel()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.setProfilingLevel.html">db.setProfilingLevel()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.shutdownServer.html">db.shutdownServer()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.stats.html">db.stats()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.version.html">db.version()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.watch.html">db.watch()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-plan-cache.html">Query Plan Cache Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.getPlanCache.html">db.collection.getPlanCache()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.clear.html">PlanCache.clear()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.clearPlansByQuery.html">PlanCache.clearPlansByQuery()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.getPlansByQuery.html">PlanCache.getPlansByQuery()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.help.html">PlanCache.help()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/PlanCache.listQueryShapes.html">PlanCache.listQueryShapes()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-bulk.html">Bulk Operation Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.initializeOrderedBulkOp.html">db.collection.initializeOrderedBulkOp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.collection.initializeUnorderedBulkOp.html">db.collection.initializeUnorderedBulkOp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.html">Bulk()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.execute.html">Bulk.execute()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.html">Bulk.find()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.arrayFilters.html">Bulk.find.arrayFilters()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.collation.html">Bulk.find.collation()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.hint.html">Bulk.find.hint()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.remove.html">Bulk.find.remove()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.removeOne.html">Bulk.find.removeOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.replaceOne.html">Bulk.find.replaceOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.updateOne.html">Bulk.find.updateOne()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.update.html">Bulk.find.update()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.find.upsert.html">Bulk.find.upsert()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.getOperations.html">Bulk.getOperations()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.insert.html">Bulk.insert()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.tojson.html">Bulk.tojson()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Bulk.toString.html">Bulk.toString()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-user-management.html">User Management Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.auth.html">db.auth()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.changeUserPassword.html">db.changeUserPassword()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.createUser.html">db.createUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropUser.html">db.dropUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropAllUsers.html">db.dropAllUsers()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getUser.html">db.getUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getUsers.html">db.getUsers()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.grantRolesToUser.html">db.grantRolesToUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.removeUser.html">db.removeUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.revokeRolesFromUser.html">db.revokeRolesFromUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.updateUser.html">db.updateUser()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/passwordPrompt.html">passwordPrompt()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-role-management.html">Role Management Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.createRole.html">db.createRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropRole.html">db.dropRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.dropAllRoles.html">db.dropAllRoles()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getRole.html">db.getRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getRoles.html">db.getRoles()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.grantPrivilegesToRole.html">db.grantPrivilegesToRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.revokePrivilegesFromRole.html">db.revokePrivilegesFromRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.grantRolesToRole.html">db.grantRolesToRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.revokeRolesFromRole.html">db.revokeRolesFromRole()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.updateRole.html">db.updateRole()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-replication.html">Replication Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.add.html">rs.add()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.addArb.html">rs.addArb()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.conf.html">rs.conf()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.freeze.html">rs.freeze()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.help.html">rs.help()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.initiate.html">rs.initiate()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.printReplicationInfo.html">rs.printReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.printSlaveReplicationInfo.html">rs.printSlaveReplicationInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.reconfig.html">rs.reconfig()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.remove.html">rs.remove()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.slaveOk.html">rs.slaveOk()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.status.html">rs.status()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.stepDown.html">rs.stepDown()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rs.syncFrom.html">rs.syncFrom()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-sharding.html">Sharding Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.addShard.html">sh.addShard()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.addShardTag.html">sh.addShardTag()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.addShardToZone.html">sh.addShardToZone()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.addTagRange.html">sh.addTagRange()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.disableBalancing.html">sh.disableBalancing()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.enableBalancing.html">sh.enableBalancing()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.disableAutoSplit.html">sh.disableAutoSplit</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.enableAutoSplit.html">sh.enableAutoSplit</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.enableSharding.html">sh.enableSharding()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.getBalancerHost.html">sh.getBalancerHost()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.getBalancerState.html">sh.getBalancerState()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.removeTagRange.html">sh.removeTagRange()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.removeRangeFromZone.html">sh.removeRangeFromZone()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.help.html">sh.help()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.isBalancerRunning.html">sh.isBalancerRunning()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.moveChunk.html">sh.moveChunk()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.removeShardTag.html">sh.removeShardTag()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.removeShardFromZone.html">sh.removeShardFromZone()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.setBalancerState.html">sh.setBalancerState()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.shardCollection.html">sh.shardCollection()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.splitAt.html">sh.splitAt()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.splitFind.html">sh.splitFind()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.startBalancer.html">sh.startBalancer()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.status.html">sh.status()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.stopBalancer.html">sh.stopBalancer()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.waitForBalancer.html">sh.waitForBalancer()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.waitForBalancerOff.html">sh.waitForBalancerOff()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.waitForPingChange.html">sh.waitForPingChange()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sh.updateZoneKeyRange.html">sh.updateZoneKeyRange()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/convertShardKeyToHashed.html">convertShardKeyToHashed</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-free-monitoring.html">Free Monitoring Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.disableFreeMonitoring.html">db.disableFreeMonitoring()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.enableFreeMonitoring.html">db.enableFreeMonitoring()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/db.getFreeMonitoringStatus.html">db.getFreeMonitoringStatus</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-constructor.html">Object Constructors and Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/BulkWriteResult.html">BulkWriteResult()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Date.html">Date()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ObjectId.html">ObjectId</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ObjectId.getTimestamp.html">ObjectId.getTimestamp()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ObjectId.toString.html">ObjectId.toString()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ObjectId.valueOf.html">ObjectId.valueOf()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/UUID.html">UUID()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/WriteResult.html">WriteResult()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/WriteResult.hasWriteError.html">WriteResult.hasWriteError()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/WriteResult.hasWriteConcernError.html">WriteResult.hasWriteConcernError()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-connection.html">Connection Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/connect.html">connect()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.html">Mongo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.getDB.html">Mongo.getDB()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.getReadPrefMode.html">Mongo.getReadPrefMode()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.getReadPrefTagSet.html">Mongo.getReadPrefTagSet()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.isCausalConsistency.html">Mongo.isCausalConsistency()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.setCausalConsistency.html">Mongo.setCausalConsistency()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.setReadPref.html">Mongo.setReadPref()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.setSlaveOk.html">Mongo.setSlaveOk()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.startSession.html">Mongo.startSession()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Mongo.watch.html">Mongo.watch()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/Session.html">Session</a><ul><li class="toctree-l5"><a class="reference internal" href="../reference/method/Session.abortTransaction.html">Session.abortTransaction()</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/method/Session.commitTransaction.html">Session.commitTransaction()</a></li><li class="toctree-l5"><a class="reference internal" href="../reference/method/Session.startTransaction.html">Session.startTransaction()</a></li></ul></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/SessionOptions.html">SessionOptions</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-native.html">Native Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/cat.html">cat()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/cd.html">cd()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/copyDbpath.html">copyDbpath()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/getHostName.html">getHostName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/getMemInfo.html">getMemInfo()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/hostname.html">hostname()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/isInteractive.html">isInteractive()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/listFiles.html">listFiles()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/load.html">load()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ls.html">ls()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/md5sumFile.html">md5sumFile()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/mkdir.html">mkdir()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/pwd.html">pwd()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/quit.html">quit()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/removeFile.html">removeFile()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/resetDbpath.html">resetDbpath()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/sleep.html">sleep()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/setVerboseShell.html">setVerboseShell()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/version.html">version()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/isWindows.html">_isWindows()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/rand.html">_rand()</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../reference/method/js-client-side-field-level-encryption.html">Client-Side Field Level Encryption Methods</a><ul><li class="toctree-l4"><a class="reference internal" href="../reference/method/getKeyVault.html">getKeyVault()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.createKey.html">KeyVault.createKey()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.deleteKey.html">KeyVault.deleteKey()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.getKey.html">KeyVault.getKey()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.getKeys.html">KeyVault.getKeys()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.addKeyAlternateName.html">KeyVault.addKeyAlternateName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.removeKeyAlternateName.html">KeyVault.removeKeyAlternateName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/KeyVault.getKeyByAltName.html">KeyVault.getKeyByAltName()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/getClientEncryption.html">getClientEncryption()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ClientEncryption.encrypt.html">ClientEncryption.encrypt()</a></li><li class="toctree-l4"><a class="reference internal" href="../reference/method/ClientEncryption.decrypt.html">ClientEncryption.decrypt()</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/program.html">MongoDB Package Components</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongod.html"><code class="docutils literal"><span class="pre">mongod</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongos.html"><code class="docutils literal"><span class="pre">mongos</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongo.html"><code class="docutils literal"><span class="pre">mongo</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongod.exe.html"><code class="docutils literal"><span class="pre">mongod.exe</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongos.exe.html"><code class="docutils literal"><span class="pre">mongos.exe</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongodump.html"><code class="docutils literal"><span class="pre">mongodump</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongorestore.html"><code class="docutils literal"><span class="pre">mongorestore</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/bsondump.html"><code class="docutils literal"><span class="pre">bsondump</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongoimport.html"><code class="docutils literal"><span class="pre">mongoimport</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongoexport.html"><code class="docutils literal"><span class="pre">mongoexport</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongostat.html"><code class="docutils literal"><span class="pre">mongostat</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongotop.html"><code class="docutils literal"><span class="pre">mongotop</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongoreplay.html"><code class="docutils literal"><span class="pre">mongoreplay</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongoldap.html"><code class="docutils literal"><span class="pre">mongoldap</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/mongofiles.html"><code class="docutils literal"><span class="pre">mongofiles</span></code></a></li><li class="toctree-l3"><a class="reference internal" href="../reference/program/install_compass.html"><code class="docutils literal"><span class="pre">install_compass</span></code></a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/configuration-options.html">Configuration File Options</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/expansion-directives.html">Externally Sourced Configuration File Values</a></li><li class="toctree-l3"><a class="reference internal" href="../tutorial/convert-command-line-options-to-yaml.html">Convert Command-Line Options to YAML</a></li><li class="toctree-l3"><a class="reference internal" href="../reference/configuration-file-settings-command-line-options-mapping.html">Configuration File Settings and Command-Line Options Mapping</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/parameters.html">MongoDB Server Parameters</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/limits.html">MongoDB Limits and Thresholds</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/explain-results.html">Explain Results</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/system-collections.html">System Collections</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/connection-string.html">Connection String URI Format</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/collation.html">Collation</a><ul><li class="toctree-l3"><a class="reference internal" href="../reference/collation-locales-defaults.html">Collation Locales and Default Parameters</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../reference/mongodb-wire-protocol.html">MongoDB Wire Protocol</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/log-messages.html">Log Messages</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/exit-codes.html">Exit Codes and Statuses</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/glossary.html">Glossary</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/default-mongodb-port.html">Default MongoDB Port</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/server-sessions.html">Server Sessions</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../release-notes.html">Release Notes</a><ul><li class="toctree-l2"><a class="reference internal" href="../release-notes/4.2.html">Release Notes for MongoDB 4.2</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-compatibility.html">Compatibility Changes in MongoDB 4.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-upgrade-standalone.html">Upgrade a Standalone to 4.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-upgrade-replica-set.html">Upgrade a Replica Set to 4.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-upgrade-sharded-cluster.html">Upgrade a Sharded Cluster to 4.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-downgrade.html">Downgrade 4.2 to 4.0</a><ul><li class="toctree-l4"><a class="reference internal" href="../release-notes/4.2-downgrade-standalone.html">Downgrade 4.2 Standalone to 4.0</a></li><li class="toctree-l4"><a class="reference internal" href="../release-notes/4.2-downgrade-replica-set.html">Downgrade 4.2 Replica Set to 4.0</a></li><li class="toctree-l4"><a class="reference internal" href="../release-notes/4.2-downgrade-sharded-cluster.html">Downgrade 4.2 Sharded Cluster to 4.0</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.2-changelog.html">4.2 Changelog</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/4.0.html">Release Notes for MongoDB 4.0</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-compatibility.html">Compatibility Changes in MongoDB 4.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-upgrade-standalone.html">Upgrade a Standalone to 4.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-upgrade-replica-set.html">Upgrade a Replica Set to 4.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-upgrade-sharded-cluster.html">Upgrade a Sharded Cluster to 4.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-downgrade-standalone.html">Downgrade 4.0 Standalone to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-downgrade-replica-set.html">Downgrade 4.0 Replica Set to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-downgrade-sharded-cluster.html">Downgrade 4.0 Sharded Cluster to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/4.0-changelog.html">4.0 Changelog</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/3.6.html">Release Notes for MongoDB 3.6</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-changelog.html">3.6 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-compatibility.html">Compatibility Changes in MongoDB 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-upgrade-standalone.html">Upgrade a Standalone to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-upgrade-replica-set.html">Upgrade a Replica Set to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-upgrade-sharded-cluster.html">Upgrade a Sharded Cluster to 3.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-downgrade-standalone.html">Downgrade 3.6 Standalone to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-downgrade-replica-set.html">Downgrade 3.6 Replica Set to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.6-downgrade-sharded-cluster.html">Downgrade 3.6 Sharded Cluster to 3.4</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/3.4.html">Release Notes for MongoDB 3.4</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-changelog.html">3.4 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-compatibility.html">Compatibility Changes in MongoDB 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-upgrade-standalone.html">Upgrade a Standalone to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-upgrade-replica-set.html">Upgrade a Replica Set to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-upgrade-sharded-cluster.html">Upgrade a Sharded Cluster to 3.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.4-downgrade.html">Downgrade MongoDB 3.4 to 3.2</a><ul><li class="toctree-l4"><a class="reference internal" href="../release-notes/3.4-downgrade-standalone.html">Downgrade 3.4 Standalone to 3.2</a></li><li class="toctree-l4"><a class="reference internal" href="../release-notes/3.4-downgrade-replica-set.html">Downgrade 3.4 Replica Set to 3.2</a></li><li class="toctree-l4"><a class="reference internal" href="../release-notes/3.4-downgrade-sharded-cluster.html">Downgrade 3.4 Sharded Cluster to 3.2</a></li></ul></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/3.2.html">Release Notes for MongoDB 3.2</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.2-changelog.html">3.2 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.2-compatibility.html">Compatibility Changes in MongoDB 3.2</a><ul><li class="toctree-l4"><a class="reference internal" href="../release-notes/3.2-javascript.html">JavaScript Changes in MongoDB 3.2</a></li></ul></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.2-upgrade.html">Upgrade MongoDB to 3.2</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.2-downgrade.html">Downgrade MongoDB from 3.2</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/3.0.html">Release Notes for MongoDB 3.0</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-changelog.html">3.0 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-compatibility.html">Compatibility Changes in MongoDB 3.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-upgrade.html">Upgrade MongoDB to 3.0</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-scram.html">Upgrade to SCRAM</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/3.0-downgrade.html">Downgrade MongoDB from 3.0</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/2.6.html">Release Notes for MongoDB 2.6</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-changelog.html">2.6 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-compatibility.html">Compatibility Changes in MongoDB 2.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-upgrade.html">Upgrade MongoDB to 2.6</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-upgrade-authorization.html">Upgrade User Authorization Data to 2.6 Format</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.6-downgrade.html">Downgrade MongoDB from 2.6</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/2.4.html">Release Notes for MongoDB 2.4</a><ul><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.4-changelog.html">2.4 Changelog</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.4-javascript.html">JavaScript Changes in MongoDB 2.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.4-upgrade.html">Upgrade MongoDB to 2.4</a></li><li class="toctree-l3"><a class="reference internal" href="../release-notes/2.4-index-types.html">Compatibility and Index Type Changes in MongoDB 2.4</a></li></ul></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/2.2.html">Release Notes for MongoDB 2.2</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/2.0.html">Release Notes for MongoDB 2.0</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/1.8.html">Release Notes for MongoDB 1.8</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/1.6.html">Release Notes for MongoDB 1.6</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/1.4.html">Release Notes for MongoDB 1.4</a></li><li class="toctree-l2"><a class="reference internal" href="../release-notes/1.2.html">Release Notes for MongoDB 1.2.x</a></li><li class="toctree-l2"><a class="reference internal" href="../reference/versioning.html">MongoDB Versioning</a></li></ul></li><li class="toctree-l1"><a class="reference internal" href="../support.html">Technical Support</a></li></ul>


    </div>
  </div>
           
         </aside>

   </div>

    <div id="main-column" class="main-column">

    <span id="showNav" class="showNav">Navigation</span>

      
        <div class="document">
            <div class="documentwrapper"><div class="bodywrapper">
              <div class="body" data-pagename="meta/aggregation-quick-reference">
                   <a class="edit-link" href="https://github.com/mongodb/docs/blob/v4.2/source/meta/aggregation-quick-reference.txt" target="_blank" title="Edit meta/aggregation-quick-reference.txt on GitHub">
    
      <span class="icon-edit"></span>
    
  </a>
                

                
  <div class="bc">
    
      <ul>
          <li><a href="../aggregation.html">Aggregation</a><span class="bcpoint"> > </span></li>
            
          <li><a href="../reference/aggregation.html">Aggregation Reference</a><span class="bcpoint"> > </span></li>
            <li>Aggregation Pipeline Quick Reference</li> 
      </ul>
    
    
  </div>
                
                  <div class="section" id="aggregation-pipeline-quick-reference">
<h1>Aggregation Pipeline Quick Reference<a class="headerlink" href="#aggregation-pipeline-quick-reference" title="Permalink to this headline">¶</a></h1>
<div class="contents singlecol local topic" id="on-this-page">
<p class="topic-title first">On this page</p>
<ul class="simple">
<li><a class="reference internal" href="#stages" id="id1">Stages</a></li>
<li><a class="reference internal" href="#expressions" id="id2">Expressions</a></li>
<li><a class="reference internal" href="#operator-expressions" id="id3">Operator Expressions</a></li>
<li><a class="reference internal" href="#index-of-expression-operators" id="id4">Index of Expression Operators</a></li>
</ul>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">For details on specific operator, including syntax and examples,
click on the specific operator to go to its reference page.</p>
</div>
<div class="section" id="stages">
<h2>Stages<a class="headerlink" href="#stages" title="Permalink to this headline">¶</a></h2>
<div class="section" id="stages-db-collection-aggregate">
<h3>Stages (<code class="docutils literal"><span class="pre">db.collection.aggregate</span></code>)<a class="headerlink" href="#stages-db-collection-aggregate" title="Permalink to this headline">¶</a></h3>
<p>In the <a class="reference internal" href="../reference/method/db.collection.aggregate.html#db.collection.aggregate" title="db.collection.aggregate"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.collection.aggregate</span></code></a> method, pipeline stages appear
in an array. Documents pass through the stages in sequence. All except
the <a class="reference internal" href="../reference/operator/aggregation/out.html#pipe._S_out" title="$out"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$out</span></code></a>, <a class="reference internal" href="../reference/operator/aggregation/merge.html#pipe._S_merge" title="$merge"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$merge</span></code></a>, and <a class="reference internal" href="../reference/operator/aggregation/geoNear.html#pipe._S_geoNear" title="$geoNear"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$geoNear</span></code></a> stages can appear
multiple times in a pipeline.</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">db</span><span class="p">.</span><span class="nx">collection</span><span class="p">.</span><span class="nx">aggregate</span><span class="p">(</span> <span class="p">[</span> <span class="p">{</span> <span class="o">&lt;</span><span class="nx">stage</span><span class="o">&gt;</span> <span class="p">},</span> <span class="p">...</span> <span class="p">]</span> <span class="p">)</span>
</pre></div>
</div>
</div>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Stage</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/addFields.html#pipe._S_addFields" title="$addFields"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$addFields</span></code></a></td>
<td><p class="first">Adds new fields to documents. Similar to
<a class="reference internal" href="../reference/operator/aggregation/project.html#pipe._S_project" title="$project"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$project</span></code></a>, <a class="reference internal" href="../reference/operator/aggregation/addFields.html#pipe._S_addFields" title="$addFields"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$addFields</span></code></a> reshapes each
document in the stream; specifically, by adding new fields to
output documents that contain both the existing fields
from the input documents and the newly added fields.</p>
<p class="last"><a class="reference internal" href="../reference/operator/aggregation/set.html#pipe._S_set" title="$set"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$set</span></code></a> is an alias for <a class="reference internal" href="../reference/operator/aggregation/addFields.html#pipe._S_addFields" title="$addFields"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$addFields</span></code></a>.</p>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/bucket.html#pipe._S_bucket" title="$bucket"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$bucket</span></code></a></td>
<td>Categorizes incoming documents into groups, called buckets,
based on a specified expression and bucket boundaries.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/bucketAuto.html#pipe._S_bucketAuto" title="$bucketAuto"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$bucketAuto</span></code></a></td>
<td>Categorizes incoming documents into a specific number of
groups, called buckets, based on a specified expression.
Bucket boundaries are automatically determined in an attempt
to evenly distribute the documents into the specified number
of buckets.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/collStats.html#pipe._S_collStats" title="$collStats"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$collStats</span></code></a></td>
<td>Returns statistics regarding a collection or view.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/count.html#pipe._S_count" title="$count"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$count</span></code></a></td>
<td>Returns a count of the number of documents at this stage of
the aggregation pipeline.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/facet.html#pipe._S_facet" title="$facet"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$facet</span></code></a></td>
<td>Processes multiple <a class="reference internal" href="../core/aggregation-pipeline.html#id1"><span class="std std-ref">aggregation pipelines</span></a> within a single stage on the same set
of input documents. Enables the creation of multi-faceted
aggregations capable of characterizing data across multiple
dimensions, or facets, in a single stage.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/geoNear.html#pipe._S_geoNear" title="$geoNear"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$geoNear</span></code></a></td>
<td>Returns an ordered stream of documents based on the proximity to a
geospatial point. Incorporates the functionality of
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a>, <a class="reference internal" href="../reference/operator/aggregation/sort.html#pipe._S_sort" title="$sort"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$sort</span></code></a>, and <a class="reference internal" href="../reference/operator/aggregation/limit.html#pipe._S_limit" title="$limit"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$limit</span></code></a> for
geospatial data. The output documents include an additional distance
field and can include a location identifier field.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/graphLookup.html#pipe._S_graphLookup" title="$graphLookup"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$graphLookup</span></code></a></td>
<td>Performs a recursive search on a collection. To each output
document, adds a new array field that contains the traversal
results of the recursive search for that document.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/group.html#pipe._S_group" title="$group"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$group</span></code></a></td>
<td>Groups input documents by a specified identifier expression
and applies the accumulator expression(s), if specified, to
each group. Consumes all input documents and outputs one
document per each distinct group. The output documents only
contain the identifier field and, if specified, accumulated
fields.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/indexStats.html#pipe._S_indexStats" title="$indexStats"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$indexStats</span></code></a></td>
<td>Returns statistics regarding the use of each index for the
collection.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/limit.html#pipe._S_limit" title="$limit"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$limit</span></code></a></td>
<td>Passes the first <em>n</em> documents unmodified to the pipeline
where <em>n</em> is the specified limit. For each input document,
outputs either one document (for the first <em>n</em> documents) or
zero documents (after the first <em>n</em> documents).</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/listSessions.html#pipe._S_listSessions" title="$listSessions"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$listSessions</span></code></a></td>
<td>Lists all sessions that have been active long enough to
propagate to the <code class="docutils literal"><span class="pre">system.sessions</span></code> collection.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/lookup.html#pipe._S_lookup" title="$lookup"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$lookup</span></code></a></td>
<td>Performs a left outer join to another collection in the
<em>same</em> database to filter in documents from the “joined”
collection for processing.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a></td>
<td>Filters the document stream to allow only matching documents
to pass unmodified into the next pipeline stage.
<a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a> uses standard MongoDB queries. For each
input document, outputs either one document (a match) or zero
documents (no match).</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/merge.html#pipe._S_merge" title="$merge"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$merge</span></code></a></td>
<td><p class="first">Writes the resulting documents of the aggregation pipeline to
a collection. The stage can incorporate (insert new
documents, merge documents, replace documents, keep existing
documents, fail the operation, process documents with a
custom update pipeline) the results into an output
collection. To use the <a class="reference internal" href="../reference/operator/aggregation/merge.html#pipe._S_merge" title="$merge"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$merge</span></code></a> stage, it must be
the last stage in the pipeline.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.2.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/out.html#pipe._S_out" title="$out"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$out</span></code></a></td>
<td>Writes the resulting documents of the aggregation pipeline to
a collection. To use the <a class="reference internal" href="../reference/operator/aggregation/out.html#pipe._S_out" title="$out"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$out</span></code></a> stage, it must be
the last stage in the pipeline.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/planCacheStats.html#pipe._S_planCacheStats" title="$planCacheStats"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$planCacheStats</span></code></a></td>
<td>Returns <a class="reference internal" href="../core/query-plans.html"><span class="doc">plan cache</span></a> information for a
collection.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/project.html#pipe._S_project" title="$project"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$project</span></code></a></td>
<td><p class="first">Reshapes each document in the stream, such as by adding new
fields or removing existing fields. For each input document,
outputs one document.</p>
<p class="last">See also <a class="reference internal" href="../reference/operator/aggregation/unset.html#pipe._S_unset" title="$unset"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$unset</span></code></a> for removing existing fields.</p>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/redact.html#pipe._S_redact" title="$redact"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$redact</span></code></a></td>
<td>Reshapes each document in the stream by restricting the
content for each document based on information stored in the
documents themselves. Incorporates the functionality of
<a class="reference internal" href="../reference/operator/aggregation/project.html#pipe._S_project" title="$project"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$project</span></code></a> and <a class="reference internal" href="../reference/operator/aggregation/match.html#pipe._S_match" title="$match"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$match</span></code></a>. Can be used to
implement field level redaction. For each input document,
outputs either one or zero documents.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/replaceRoot.html#pipe._S_replaceRoot" title="$replaceRoot"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$replaceRoot</span></code></a></td>
<td><p class="first">Replaces a document with the specified embedded document. The
operation replaces all existing fields in the input document,
including the <code class="docutils literal"><span class="pre">_id</span></code> field. Specify a document embedded in
the input document to promote the embedded document to the
top level.</p>
<p class="last"><a class="reference internal" href="../reference/operator/aggregation/replaceWith.html#pipe._S_replaceWith" title="$replaceWith"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$replaceWith</span></code></a> is an alias for
<a class="reference internal" href="../reference/operator/aggregation/replaceRoot.html#pipe._S_replaceRoot" title="$replaceRoot"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$replaceRoot</span></code></a> stage.</p>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/replaceWith.html#pipe._S_replaceWith" title="$replaceWith"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$replaceWith</span></code></a></td>
<td><p class="first">Replaces a document with the specified embedded document. The
operation replaces all existing fields in the input document,
including the <code class="docutils literal"><span class="pre">_id</span></code> field. Specify a document embedded in
the input document to promote the embedded document to the
top level.</p>
<p class="last"><a class="reference internal" href="../reference/operator/aggregation/replaceWith.html#pipe._S_replaceWith" title="$replaceWith"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$replaceWith</span></code></a> is an alias for
<a class="reference internal" href="../reference/operator/aggregation/replaceRoot.html#pipe._S_replaceRoot" title="$replaceRoot"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$replaceRoot</span></code></a> stage.</p>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/sample.html#pipe._S_sample" title="$sample"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$sample</span></code></a></td>
<td>Randomly selects the specified number of documents from its
input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/set.html#pipe._S_set" title="$set"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$set</span></code></a></td>
<td><p class="first">Adds new fields to documents. Similar to
<a class="reference internal" href="../reference/operator/aggregation/project.html#pipe._S_project" title="$project"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$project</span></code></a>, <a class="reference internal" href="../reference/operator/aggregation/set.html#pipe._S_set" title="$set"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$set</span></code></a> reshapes each
document in the stream; specifically, by adding new fields to
output documents that contain both the existing fields
from the input documents and the newly added fields.</p>
<p class="last"><a class="reference internal" href="../reference/operator/aggregation/set.html#pipe._S_set" title="$set"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$set</span></code></a> is an alias for <a class="reference internal" href="../reference/operator/aggregation/addFields.html#pipe._S_addFields" title="$addFields"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$addFields</span></code></a> stage.</p>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/skip.html#pipe._S_skip" title="$skip"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$skip</span></code></a></td>
<td>Skips the first <em>n</em> documents where <em>n</em> is the specified skip
number and passes the remaining documents unmodified to the
pipeline. For each input document, outputs either zero
documents (for the first <em>n</em> documents) or one document (if
after the first <em>n</em> documents).</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/sort.html#pipe._S_sort" title="$sort"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$sort</span></code></a></td>
<td>Reorders the document stream by a specified sort key. Only
the order changes; the documents remain unmodified. For each
input document, outputs one document.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/sortByCount.html#pipe._S_sortByCount" title="$sortByCount"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$sortByCount</span></code></a></td>
<td>Groups incoming documents based on the value of a specified
expression, then computes the count of documents in each
distinct group.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/unset.html#pipe._S_unset" title="$unset"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$unset</span></code></a></td>
<td><p class="first">Removes/excludes fields from documents.</p>
<p class="last"><a class="reference internal" href="../reference/operator/aggregation/unset.html#pipe._S_unset" title="$unset"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$unset</span></code></a> is an alias for <a class="reference internal" href="../reference/operator/aggregation/project.html#pipe._S_project" title="$project"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$project</span></code></a> stage
that removes fields.</p>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/unwind.html#pipe._S_unwind" title="$unwind"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$unwind</span></code></a></td>
<td>Deconstructs an array field from the input documents to
output a document for <em>each</em> element. Each output document
replaces the array with an element value. For each input
document, outputs <em>n</em> documents where <em>n</em> is the number of
array elements and can be zero for an empty array.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="stages-db-aggregate">
<h3>Stages (<code class="docutils literal"><span class="pre">db.aggregate</span></code>)<a class="headerlink" href="#stages-db-aggregate" title="Permalink to this headline">¶</a></h3>
<p>Starting in version 3.6, MongoDB also provides the
<a class="reference internal" href="../reference/method/db.aggregate.html#db.aggregate" title="db.aggregate"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.aggregate</span></code></a> method:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="nx">db</span><span class="p">.</span><span class="nx">aggregate</span><span class="p">(</span> <span class="p">[</span> <span class="p">{</span> <span class="o">&lt;</span><span class="nx">stage</span><span class="o">&gt;</span> <span class="p">},</span> <span class="p">...</span> <span class="p">]</span> <span class="p">)</span>
</pre></div>
</div>
</div>
<p>The following stages use the <a class="reference internal" href="../reference/method/db.aggregate.html#db.aggregate" title="db.aggregate()"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.aggregate()</span></code></a> method and not
the <a class="reference internal" href="../reference/method/db.collection.aggregate.html#db.collection.aggregate" title="db.collection.aggregate()"><code class="xref mongodb mongodb-method docutils literal"><span class="pre">db.collection.aggregate()</span></code></a> method.</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Stage</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/currentOp.html#pipe._S_currentOp" title="$currentOp"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$currentOp</span></code></a></td>
<td>Returns information on active and/or dormant operations for
the MongoDB deployment.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/listLocalSessions.html#pipe._S_listLocalSessions" title="$listLocalSessions"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$listLocalSessions</span></code></a></td>
<td>Lists all active sessions recently in use on the currently
connected <a class="reference internal" href="../reference/program/mongos.html#bin.mongos" title="bin.mongos"><code class="xref mongodb mongodb-binary docutils literal"><span class="pre">mongos</span></code></a> or <a class="reference internal" href="../reference/program/mongod.html#bin.mongod" title="bin.mongod"><code class="xref mongodb mongodb-binary docutils literal"><span class="pre">mongod</span></code></a>
instance. These sessions may have not yet propagated to the
<code class="docutils literal"><span class="pre">system.sessions</span></code> collection.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="stages-available-for-updates">
<h3>Stages Available for Updates<a class="headerlink" href="#stages-available-for-updates" title="Permalink to this headline">¶</a></h3>
<p>Starting in MongoDB 4.2, you can use the aggregation pipeline for
updates in:</p>
<table border="1" class="docutils">
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Command</th>
<th class="head"><code class="docutils literal"><span class="pre">mongo</span></code> Shell Methods</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/command/findAndModify.html#dbcmd.findAndModify" title="findAndModify"><code class="xref mongodb mongodb-dbcommand docutils literal"><span class="pre">findAndModify</span></code></a></td>
<td><div class="first last line-block">
<div class="line"><a class="reference internal" href="../reference/method/db.collection.findOneAndUpdate.html#findoneandupdate-agg-pipeline"><span class="std std-ref">db.collection.findOneAndUpdate()</span></a></div>
<div class="line"><a class="reference internal" href="../reference/method/db.collection.findAndModify.html#findandmodify-agg-pipeline"><span class="std std-ref">db.collection.findAndModify()</span></a></div>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/command/update.html#dbcmd.update" title="update"><code class="xref mongodb mongodb-dbcommand docutils literal"><span class="pre">update</span></code></a></td>
<td><div class="first line-block">
<div class="line"><a class="reference internal" href="../reference/method/db.collection.updateOne.html#updateone-example-agg"><span class="std std-ref">db.collection.updateOne()</span></a></div>
<div class="line"><a class="reference internal" href="../reference/method/db.collection.updateMany.html#updatemany-example-agg"><span class="std std-ref">db.collection.updateMany()</span></a></div>
<div class="line"><a class="reference internal" href="../reference/method/db.collection.update.html#update-example-agg"><span class="std std-ref">db.collection.update()</span></a></div>
</div>
<div class="last line-block">
<div class="line"><a class="reference internal" href="../reference/method/Bulk.find.update.html#example-bulk-find-update-agg"><span class="std std-ref">Bulk.find.update()</span></a></div>
<div class="line"><a class="reference internal" href="../reference/method/Bulk.find.updateOne.html#example-bulk-find-update-one-agg"><span class="std std-ref">Bulk.find.updateOne()</span></a></div>
<div class="line"><a class="reference internal" href="../reference/method/Bulk.find.upsert.html#bulk-find-upsert-update-agg-example"><span class="std std-ref">Bulk.find.upsert()</span></a></div>
</div>
</td>
</tr>
</tbody>
</table>
<p>For the updates, the pipeline can consist of the following stages:</p>
<ul class="simple">
<li><a class="reference internal" href="../reference/operator/aggregation/addFields.html#pipe._S_addFields" title="$addFields"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$addFields</span></code></a> and its alias <a class="reference internal" href="../reference/operator/aggregation/set.html#pipe._S_set" title="$set"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$set</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/project.html#pipe._S_project" title="$project"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$project</span></code></a> and its alias <a class="reference internal" href="../reference/operator/aggregation/unset.html#pipe._S_unset" title="$unset"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$unset</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/replaceRoot.html#pipe._S_replaceRoot" title="$replaceRoot"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$replaceRoot</span></code></a> and its alias <a class="reference internal" href="../reference/operator/aggregation/replaceWith.html#pipe._S_replaceWith" title="$replaceWith"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$replaceWith</span></code></a>.</li>
</ul>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference internal" href="../tutorial/update-documents-with-aggregation-pipeline.html"><span class="doc">Updates with Aggregation Pipeline</span></a></p>
</div>
</div>
</div>
<div class="section" id="expressions">
<span id="aggregation-expressions"></span><h2>Expressions<a class="headerlink" href="#expressions" title="Permalink to this headline">¶</a></h2>
<p>Expressions can include <a class="reference internal" href="#agg-quick-ref-field-paths"><span class="std std-ref">field paths</span></a>,
<a class="reference internal" href="#agg-quick-ref-literals"><span class="std std-ref">literals</span></a>, <a class="reference internal" href="#agg-quick-ref-variables"><span class="std std-ref">system variables</span></a>, <a class="reference internal" href="#agg-quick-ref-expression-objects"><span class="std std-ref">expression objects</span></a>, and <a class="reference internal" href="#agg-quick-ref-operator-expressions"><span class="std std-ref">expression operators</span></a>. Expressions can be nested.</p>
<div class="section" id="field-paths">
<span id="agg-quick-ref-field-paths"></span><h3>Field Paths<a class="headerlink" href="#field-paths" title="Permalink to this headline">¶</a></h3>
<p>Aggregation expressions use <a class="reference internal" href="../reference/glossary.html#term-field-path"><span class="xref std std-term">field path</span></a> to access fields in the
input documents. To specify a field path, prefix the field name or the
<a class="reference internal" href="../core/document.html#document-dot-notation"><span class="std std-ref">dotted field name</span></a> (if the field is in
the embedded document) with a dollar sign <code class="docutils literal"><span class="pre">$</span></code>. For example,
<code class="docutils literal"><span class="pre">&quot;$user&quot;</span></code> to specify the field path for the <code class="docutils literal"><span class="pre">user</span></code> field or
<code class="docutils literal"><span class="pre">&quot;$user.name&quot;</span></code> to specify the field path to <code class="docutils literal"><span class="pre">&quot;user.name&quot;</span></code> field.</p>
<p><code class="docutils literal"><span class="pre">&quot;$&lt;field&gt;&quot;</span></code> is equivalent to <code class="docutils literal"><span class="pre">&quot;$$CURRENT.&lt;field&gt;&quot;</span></code> where the
<a class="reference internal" href="../reference/aggregation-variables.html#variable.CURRENT" title="CURRENT"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">CURRENT</span></code></a> is a system variable that defaults to the root of
the current object, unless stated otherwise in specific stages.</p>
</div>
<div class="section" id="aggregation-variables">
<span id="agg-quick-ref-variables"></span><h3>Aggregation Variables<a class="headerlink" href="#aggregation-variables" title="Permalink to this headline">¶</a></h3>
<p>MongoDB provides various aggregation <a class="reference internal" href="../reference/aggregation-variables.html#agg-system-variables"><span class="std std-ref">system variables</span></a> for use in expressions. To access variables,
prefix the variable name with <code class="docutils literal"><span class="pre">$$</span></code>. For example:</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="16%" />
<col width="16%" />
<col width="68%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Variable</th>
<th class="head">Access via <code class="docutils literal"><span class="pre">$$</span></code></th>
<th class="head">Brief Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/aggregation-variables.html#variable.NOW" title="NOW"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">NOW</span></code></a></td>
<td><code class="docutils literal"><span class="pre">$$NOW</span></code></td>
<td>Returns the current datetime value, which is same across all
members of the deployment and remains constant throughout the
aggregation pipeline. (Available in 4.2+)</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/aggregation-variables.html#variable.CLUSTER_TIME" title="CLUSTER_TIME"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">CLUSTER_TIME</span></code></a></td>
<td><code class="docutils literal"><span class="pre">$$CLUSTER_TIME</span></code></td>
<td>Returns the current timestamp value, which is same across all
members of the deployment and remains constant throughout the
aggregation pipeline. For replica sets and sharded clusters
only. (Available in 4.2+)</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/aggregation-variables.html#variable.ROOT" title="ROOT"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">ROOT</span></code></a></td>
<td><code class="docutils literal"><span class="pre">$$ROOT</span></code></td>
<td>Refrences the root document, i.e. the top-level document.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/aggregation-variables.html#variable.CURRENT" title="CURRENT"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">CURRENT</span></code></a></td>
<td><code class="docutils literal"><span class="pre">$$CURRENT</span></code></td>
<td>References the start of the field path, which by default is
<a class="reference internal" href="../reference/aggregation-variables.html#variable.ROOT" title="ROOT"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">ROOT</span></code></a> but can be changed.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/aggregation-variables.html#variable.REMOVE" title="REMOVE"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">REMOVE</span></code></a></td>
<td><code class="docutils literal"><span class="pre">$$REMOVE</span></code></td>
<td>Allows for the conditional exclusion of fields. (Available in 3.6+)</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/aggregation-variables.html#variable.DESCEND" title="DESCEND"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">DESCEND</span></code></a></td>
<td><code class="docutils literal"><span class="pre">$$DESCEND</span></code></td>
<td>One of the allowed results of a <a class="reference internal" href="../reference/operator/aggregation/redact.html#pipe._S_redact" title="$redact"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$redact</span></code></a> expression.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/aggregation-variables.html#variable.PRUNE" title="PRUNE"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">PRUNE</span></code></a></td>
<td><code class="docutils literal"><span class="pre">$$PRUNE</span></code></td>
<td>One of the allowed results of a <a class="reference internal" href="../reference/operator/aggregation/redact.html#pipe._S_redact" title="$redact"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$redact</span></code></a> expression.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/aggregation-variables.html#variable.KEEP" title="KEEP"><code class="xref mongodb mongodb-variable docutils literal"><span class="pre">KEEP</span></code></a></td>
<td><code class="docutils literal"><span class="pre">$$KEEP</span></code></td>
<td>One of the allowed results of a <a class="reference internal" href="../reference/operator/aggregation/redact.html#pipe._S_redact" title="$redact"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$redact</span></code></a> expression.</td>
</tr>
</tbody>
</table>
<p>For a more detailed description of these variables, see <a class="reference internal" href="../reference/aggregation-variables.html#agg-system-variables"><span class="std std-ref">system
variables</span></a>.</p>
</div>
<div class="section" id="literals">
<span id="agg-quick-ref-literals"></span><h3>Literals<a class="headerlink" href="#literals" title="Permalink to this headline">¶</a></h3>
<p>Literals can be of any type. However, MongoDB parses string literals
that start with a dollar sign <code class="docutils literal"><span class="pre">$</span></code> as a path to a field and
numeric/boolean literals in <a class="reference internal" href="#agg-quick-ref-expression-objects"><span class="std std-ref">expression objects</span></a> as projection flags. To avoid
parsing literals, use the <a class="reference internal" href="../reference/operator/aggregation/literal.html#exp._S_literal" title="$literal"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$literal</span></code></a> expression.</p>
</div>
<div class="section" id="expression-objects">
<span id="agg-quick-ref-expression-objects"></span><h3>Expression Objects<a class="headerlink" href="#expression-objects" title="Permalink to this headline">¶</a></h3>
<p>Expression objects have the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="nx">field1</span><span class="o">&gt;:</span> <span class="o">&lt;</span><span class="nx">expression1</span><span class="o">&gt;</span><span class="p">,</span> <span class="p">...</span> <span class="p">}</span>
</pre></div>
</div>
</div>
<p>If the expressions are numeric or boolean literals, MongoDB treats the
literals as projection flags (e.g. <code class="docutils literal"><span class="pre">1</span></code> or <code class="docutils literal"><span class="pre">true</span></code> to include the
field), valid only in the <a class="reference internal" href="../reference/operator/aggregation/project.html#pipe._S_project" title="$project"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$project</span></code></a> stage. To avoid treating
numeric or boolean literals as projection flags, use the
<a class="reference internal" href="../reference/operator/aggregation/literal.html#exp._S_literal" title="$literal"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$literal</span></code></a> expression to wrap the numeric or boolean
literals.</p>
</div>
</div>
<div class="section" id="operator-expressions">
<span id="agg-quick-ref-operator-expressions"></span><h2>Operator Expressions<a class="headerlink" href="#operator-expressions" title="Permalink to this headline">¶</a></h2>
<div class="contents twocols local topic" id="in-this-section">
<p class="topic-title first">In this section</p>
<ul class="simple">
<li><a class="reference internal" href="#arithmetic-expression-operators" id="id5">Arithmetic Expression Operators</a></li>
<li><a class="reference internal" href="#array-expression-operators" id="id6">Array Expression Operators</a></li>
<li><a class="reference internal" href="#boolean-expression-operators" id="id7">Boolean Expression Operators</a></li>
<li><a class="reference internal" href="#comparison-expression-operators" id="id8">Comparison Expression Operators</a></li>
<li><a class="reference internal" href="#conditional-expression-operators" id="id9">Conditional Expression Operators</a></li>
<li><a class="reference internal" href="#date-expression-operators" id="id10">Date Expression Operators</a></li>
<li><a class="reference internal" href="#literal-expression-operator" id="id11">Literal Expression Operator</a></li>
<li><a class="reference internal" href="#object-expression-operators" id="id12">Object Expression Operators</a></li>
<li><a class="reference internal" href="#set-expression-operators" id="id13">Set Expression Operators</a></li>
<li><a class="reference internal" href="#string-expression-operators" id="id14">String Expression Operators</a></li>
<li><a class="reference internal" href="#text-expression-operator" id="id15">Text Expression Operator</a></li>
<li><a class="reference internal" href="#trigonometry-expression-operators" id="id16">Trigonometry Expression Operators</a></li>
<li><a class="reference internal" href="#type-expression-operators" id="id17">Type Expression Operators</a></li>
<li><a class="reference internal" href="#accumulators-group" id="id18">Accumulators (<code class="docutils literal"><span class="pre">$group</span></code>)</a></li>
<li><a class="reference internal" href="#accumulators-in-other-stages" id="id19">Accumulators (in Other Stages)</a></li>
<li><a class="reference internal" href="#variable-expression-operators" id="id20">Variable Expression Operators</a></li>
</ul>
</div>
<p>Operator expressions are similar to functions that take arguments.
In general, these expressions take an array of arguments
and have the following form:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="nx">operator</span><span class="o">&gt;:</span> <span class="p">[</span> <span class="o">&lt;</span><span class="nx">argument1</span><span class="o">&gt;</span><span class="p">,</span> <span class="o">&lt;</span><span class="nx">argument2</span><span class="o">&gt;</span> <span class="p">...</span> <span class="p">]</span> <span class="p">}</span>
</pre></div>
</div>
</div>
<p>If operator accepts a single argument, you can omit the outer array
designating the argument list:</p>
<div class="button-code-block">
<div class="button-row">
<a class="code-button--copy code-button" role="button">
copy</a>
</div>
<div class="copyable-code-block highlight-javascript"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="o">&lt;</span><span class="nx">operator</span><span class="o">&gt;:</span> <span class="o">&lt;</span><span class="nx">argument</span><span class="o">&gt;</span> <span class="p">}</span>
</pre></div>
</div>
</div>
<p>To avoid parsing ambiguity if the argument is a literal array, you must
wrap the literal array in a <a class="reference internal" href="../reference/operator/aggregation/literal.html#exp._S_literal" title="$literal"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$literal</span></code></a> expression or keep
the outer array that designates the argument list.</p>
<div class="section" id="arithmetic-expression-operators">
<span id="agg-quick-ref-operator-arithmetic"></span><h3>Arithmetic Expression Operators<a class="headerlink" href="#arithmetic-expression-operators" title="Permalink to this headline">¶</a></h3>
<p>Arithmetic expressions perform mathematic operations on numbers. Some
arithmetic expressions can also support date arithmetic.</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/abs.html#exp._S_abs" title="$abs"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$abs</span></code></a></td>
<td>Returns the absolute value of a number.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/add.html#exp._S_add" title="$add"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$add</span></code></a></td>
<td>Adds numbers to return the sum, or adds numbers and a date to
return a new date. If adding numbers and a date, treats the
numbers as milliseconds. Accepts any number of argument
expressions, but at most, one expression can resolve to a
date.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/ceil.html#exp._S_ceil" title="$ceil"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ceil</span></code></a></td>
<td>Returns the smallest integer greater than or equal to the specified number.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/divide.html#exp._S_divide" title="$divide"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$divide</span></code></a></td>
<td>Returns the result of dividing the first number by the
second. Accepts two argument expressions.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/exp.html#exp._S_exp" title="$exp"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$exp</span></code></a></td>
<td>Raises <em>e</em> to the specified exponent.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/floor.html#exp._S_floor" title="$floor"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$floor</span></code></a></td>
<td>Returns the largest integer less than or equal to the
specified number.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/ln.html#exp._S_ln" title="$ln"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ln</span></code></a></td>
<td>Calculates the natural log of a number.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/log.html#exp._S_log" title="$log"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$log</span></code></a></td>
<td>Calculates the log of a number in the specified base.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/log10.html#exp._S_log10" title="$log10"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$log10</span></code></a></td>
<td>Calculates the log base 10 of a number.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/mod.html#exp._S_mod" title="$mod"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$mod</span></code></a></td>
<td>Returns the remainder of the first number divided by the
second. Accepts two argument expressions.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/multiply.html#exp._S_multiply" title="$multiply"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$multiply</span></code></a></td>
<td>Multiplies numbers to return the product. Accepts any number
of argument expressions.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/pow.html#exp._S_pow" title="$pow"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$pow</span></code></a></td>
<td>Raises a number to the specified exponent.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/round.html#exp._S_round" title="$round"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$round</span></code></a></td>
<td>Rounds a number to to a whole integer <em>or</em> to a specified
decimal place.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/sqrt.html#exp._S_sqrt" title="$sqrt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$sqrt</span></code></a></td>
<td>Calculates the square root.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/subtract.html#exp._S_subtract" title="$subtract"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$subtract</span></code></a></td>
<td>Returns the result of subtracting the second value from the
first. If the two values are numbers, return the difference.
If the two values are dates, return the difference in
milliseconds. If the two values are a date and a number in
milliseconds, return the resulting date. Accepts two argument
expressions. If the two values are a date and a number,
specify the date argument first as it is not meaningful to
subtract a date from a number.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/trunc.html#exp._S_trunc" title="$trunc"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$trunc</span></code></a></td>
<td>Truncates a number to a whole integer <em>or</em> to a specified
decimal place.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-expression-operators">
<h3>Array Expression Operators<a class="headerlink" href="#array-expression-operators" title="Permalink to this headline">¶</a></h3>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head"><a class="reference internal" href="../reference/operator/aggregation/arrayElemAt.html#exp._S_arrayElemAt" title="$arrayElemAt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$arrayElemAt</span></code></a></th>
<th class="head">Returns the element at the specified array index.</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/arrayToObject.html#exp._S_arrayToObject" title="$arrayToObject"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$arrayToObject</span></code></a></td>
<td>Converts an array of key value pairs to a document.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/concatArrays.html#exp._S_concatArrays" title="$concatArrays"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$concatArrays</span></code></a></td>
<td>Concatenates arrays to return the concatenated array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/filter.html#exp._S_filter" title="$filter"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$filter</span></code></a></td>
<td>Selects a subset of the array to return an array with only
the elements that match the filter condition.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/in.html#exp._S_in" title="$in"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$in</span></code></a></td>
<td>Returns a boolean indicating whether a specified value is in
an array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/indexOfArray.html#exp._S_indexOfArray" title="$indexOfArray"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$indexOfArray</span></code></a></td>
<td>Searches an array for an occurence of a specified value and
returns the array index of the first occurence. If the
substring is not found, returns <code class="docutils literal"><span class="pre">-1</span></code>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/isArray.html#exp._S_isArray" title="$isArray"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$isArray</span></code></a></td>
<td>Determines if the operand is an array. Returns a boolean.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/map.html#exp._S_map" title="$map"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$map</span></code></a></td>
<td>Applies a subexpression to each element of an array and
returns the array of resulting values in order. Accepts named
parameters.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/objectToArray.html#exp._S_objectToArray" title="$objectToArray"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$objectToArray</span></code></a></td>
<td>Converts a document to an array of documents representing
key-value pairs.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/range.html#exp._S_range" title="$range"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$range</span></code></a></td>
<td>Outputs an array containing a sequence of integers according
to user-defined inputs.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/reduce.html#exp._S_reduce" title="$reduce"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$reduce</span></code></a></td>
<td>Applies an expression to each element in an array and
combines them into a single value.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/reverseArray.html#exp._S_reverseArray" title="$reverseArray"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$reverseArray</span></code></a></td>
<td>Returns an array with the elements in reverse order.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/size.html#exp._S_size" title="$size"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$size</span></code></a></td>
<td>Returns the number of elements in the array. Accepts a single
expression as argument.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/slice.html#exp._S_slice" title="$slice"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$slice</span></code></a></td>
<td>Returns a subset of an array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/zip.html#exp._S_zip" title="$zip"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$zip</span></code></a></td>
<td>Merge two arrays together.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="boolean-expression-operators">
<h3>Boolean Expression Operators<a class="headerlink" href="#boolean-expression-operators" title="Permalink to this headline">¶</a></h3>
<p>Boolean expressions evaluate their argument expressions as booleans and
return a boolean as the result.</p>
<p>In addition to the <code class="docutils literal"><span class="pre">false</span></code> boolean value, Boolean expression evaluates
as <code class="docutils literal"><span class="pre">false</span></code> the following: <code class="docutils literal"><span class="pre">null</span></code>, <code class="docutils literal"><span class="pre">0</span></code>, and <code class="docutils literal"><span class="pre">undefined</span></code>
values. The Boolean expression evaluates all other values as <code class="docutils literal"><span class="pre">true</span></code>,
including non-zero numeric values and arrays.</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/and.html#exp._S_and" title="$and"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$and</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> only when <em>all</em> its expressions evaluate to
<code class="docutils literal"><span class="pre">true</span></code>. Accepts any number of argument expressions.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/not.html#exp._S_not" title="$not"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$not</span></code></a></td>
<td>Returns the boolean value that is the opposite of its
argument expression. Accepts a single argument expression.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/or.html#exp._S_or" title="$or"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$or</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> when <em>any</em> of its expressions evaluates to
<code class="docutils literal"><span class="pre">true</span></code>. Accepts any number of argument expressions.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="comparison-expression-operators">
<h3>Comparison Expression Operators<a class="headerlink" href="#comparison-expression-operators" title="Permalink to this headline">¶</a></h3>
<p>Comparison expressions return a boolean except for <a class="reference internal" href="../reference/operator/aggregation/cmp.html#exp._S_cmp" title="$cmp"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$cmp</span></code></a>
which returns a number.</p>
<p>The comparison expressions take two argument expressions and compare
both value and type, using the <a class="reference internal" href="../reference/bson-type-comparison-order.html#bson-types-comparison-order"><span class="std std-ref">specified BSON comparison order</span></a> for values of different types.</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head"><a class="reference internal" href="../reference/operator/aggregation/cmp.html#exp._S_cmp" title="$cmp"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$cmp</span></code></a></th>
<th class="head">Returns <code class="docutils literal"><span class="pre">0</span></code> if the two values are equivalent, <code class="docutils literal"><span class="pre">1</span></code> if the
first value is greater than the second, and <code class="docutils literal"><span class="pre">-1</span></code> if the
first value is less than the second.</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/eq.html#exp._S_eq" title="$eq"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$eq</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if the values are equivalent.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/gt.html#exp._S_gt" title="$gt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$gt</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if the first value is greater than the
second.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/gte.html#exp._S_gte" title="$gte"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$gte</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if the first value is greater than or equal
to the second.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/lt.html#exp._S_lt" title="$lt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$lt</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if the first value is less than the second.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/lte.html#exp._S_lte" title="$lte"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$lte</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if the first value is less than or equal to
the second.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/ne.html#exp._S_ne" title="$ne"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ne</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if the values are <em>not</em> equivalent.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="conditional-expression-operators">
<h3>Conditional Expression Operators<a class="headerlink" href="#conditional-expression-operators" title="Permalink to this headline">¶</a></h3>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/cond.html#exp._S_cond" title="$cond"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$cond</span></code></a></td>
<td>A ternary operator that evaluates one expression, and
depending on the result, returns the value of one of the
other two expressions. Accepts either three expressions in an
ordered list or three named parameters.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/ifNull.html#exp._S_ifNull" title="$ifNull"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ifNull</span></code></a></td>
<td>Returns either the non-null result of the first expression or
the result of the second expression if the first expression
results in a null result. Null result encompasses instances
of undefined values or missing fields. Accepts two
expressions as arguments. The result of the second expression
can be null.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/switch.html#exp._S_switch" title="$switch"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$switch</span></code></a></td>
<td>Evaluates a series of case expressions. When it finds an
expression which evaluates to <code class="docutils literal"><span class="pre">true</span></code>, <code class="docutils literal"><span class="pre">$switch</span></code> executes
a specified expression and breaks out of the control flow.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="date-expression-operators">
<span id="agg-qr-date-operators"></span><h3>Date Expression Operators<a class="headerlink" href="#date-expression-operators" title="Permalink to this headline">¶</a></h3>
<p>The following operators returns date objects or components of a date
object:</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/dateFromParts.html#exp._S_dateFromParts" title="$dateFromParts"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateFromParts</span></code></a></td>
<td>Constructs a BSON Date object given the date’s constituent
parts.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/dateFromString.html#exp._S_dateFromString" title="$dateFromString"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateFromString</span></code></a></td>
<td>Converts a date/time string to a date object.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/dateToParts.html#exp._S_dateToParts" title="$dateToParts"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateToParts</span></code></a></td>
<td>Returns a document containing the constituent parts of a date.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/dateToString.html#exp._S_dateToString" title="$dateToString"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateToString</span></code></a></td>
<td>Returns the date as a formatted string.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/dayOfMonth.html#exp._S_dayOfMonth" title="$dayOfMonth"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dayOfMonth</span></code></a></td>
<td>Returns the day of the month for a date as a number between 1
and 31.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/dayOfWeek.html#exp._S_dayOfWeek" title="$dayOfWeek"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dayOfWeek</span></code></a></td>
<td>Returns the day of the week for a date as a number between 1
(Sunday) and 7 (Saturday).</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/dayOfYear.html#exp._S_dayOfYear" title="$dayOfYear"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dayOfYear</span></code></a></td>
<td>Returns the day of the year for a date as a number between 1
and 366 (leap year).</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/hour.html#exp._S_hour" title="$hour"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$hour</span></code></a></td>
<td>Returns the hour for a date as a number between 0 and 23.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/isoDayOfWeek.html#exp._S_isoDayOfWeek" title="$isoDayOfWeek"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$isoDayOfWeek</span></code></a></td>
<td>Returns the weekday number in ISO 8601 format, ranging from
<code class="docutils literal"><span class="pre">1</span></code> (for Monday) to <code class="docutils literal"><span class="pre">7</span></code> (for Sunday).</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/isoWeek.html#exp._S_isoWeek" title="$isoWeek"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$isoWeek</span></code></a></td>
<td>Returns the week number in ISO 8601 format, ranging from
<code class="docutils literal"><span class="pre">1</span></code> to <code class="docutils literal"><span class="pre">53</span></code>. Week numbers start at <code class="docutils literal"><span class="pre">1</span></code> with the week
(Monday through Sunday) that contains the year’s first
Thursday.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/isoWeekYear.html#exp._S_isoWeekYear" title="$isoWeekYear"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$isoWeekYear</span></code></a></td>
<td>Returns the year number in ISO 8601 format. The year starts
with the Monday of week 1 (ISO 8601) and ends with the Sunday
of the last week (ISO 8601).</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/millisecond.html#exp._S_millisecond" title="$millisecond"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$millisecond</span></code></a></td>
<td>Returns the milliseconds of a date as a number between 0 and
999.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/minute.html#exp._S_minute" title="$minute"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$minute</span></code></a></td>
<td>Returns the minute for a date as a number between 0 and 59.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/month.html#exp._S_month" title="$month"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$month</span></code></a></td>
<td>Returns the month for a date as a number between 1 (January)
and 12 (December).</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/second.html#exp._S_second" title="$second"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$second</span></code></a></td>
<td>Returns the seconds for a date as a number between 0 and 60
(leap seconds).</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/toDate.html#exp._S_toDate" title="$toDate"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toDate</span></code></a></td>
<td><p class="first">Converts value to a Date.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/week.html#exp._S_week" title="$week"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$week</span></code></a></td>
<td>Returns the week number for a date as a number between 0 (the
partial week that precedes the first Sunday of the year) and
53 (leap year).</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/year.html#exp._S_year" title="$year"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$year</span></code></a></td>
<td>Returns the year for a date as a number (e.g. 2014).</td>
</tr>
</tbody>
</table>
<p>The following arithmetic operators can take date operands:</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/add.html#exp._S_add" title="$add"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$add</span></code></a></td>
<td>Adds numbers and a date to return a new date. If adding
numbers and a date, treats the numbers as milliseconds.
Accepts any number of argument expressions, but at most, one
expression can resolve to a date.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/subtract.html#exp._S_subtract" title="$subtract"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$subtract</span></code></a></td>
<td>Returns the result of subtracting the second value from the
first. If the two values are dates, return the difference in
milliseconds. If the two values are a date and a number in
milliseconds, return the resulting date. Accepts two argument
expressions. If the two values are a date and a number,
specify the date argument first as it is not meaningful to
subtract a date from a number.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="literal-expression-operator">
<h3>Literal Expression Operator<a class="headerlink" href="#literal-expression-operator" title="Permalink to this headline">¶</a></h3>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/literal.html#exp._S_literal" title="$literal"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$literal</span></code></a></td>
<td>Return a value without parsing. Use for values that the
aggregation pipeline may interpret as an expression. For
example, use a <a class="reference internal" href="../reference/operator/aggregation/literal.html#exp._S_literal" title="$literal"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$literal</span></code></a> expression to a string
that starts with a <code class="docutils literal"><span class="pre">$</span></code> to avoid parsing as a field path.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="object-expression-operators">
<h3>Object Expression Operators<a class="headerlink" href="#object-expression-operators" title="Permalink to this headline">¶</a></h3>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/mergeObjects.html#exp._S_mergeObjects" title="$mergeObjects"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$mergeObjects</span></code></a></td>
<td><p class="first">Combines multiple documents into a single document.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 3.6.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/objectToArray.html#exp._S_objectToArray" title="$objectToArray"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$objectToArray</span></code></a></td>
<td><p class="first">Converts a document to an array of documents representing
key-value pairs.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 3.6.</span></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="set-expression-operators">
<span id="agg-qr-set-operators"></span><h3>Set Expression Operators<a class="headerlink" href="#set-expression-operators" title="Permalink to this headline">¶</a></h3>
<p>Set expressions performs set operation on arrays, treating arrays as
sets. Set expressions ignores the duplicate entries in each input array
and the order of the elements.</p>
<p>If the set operation returns a set, the operation filters out
duplicates in the result to output an array that contains only unique
entries. The order of the elements in the output array is unspecified.</p>
<p>If a set contains a nested array element, the set expression does <em>not</em> descend
into the nested array but evaluates the array at top-level.</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/allElementsTrue.html#exp._S_allElementsTrue" title="$allElementsTrue"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$allElementsTrue</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if <em>no</em> element of a set evaluates to
<code class="docutils literal"><span class="pre">false</span></code>, otherwise, returns <code class="docutils literal"><span class="pre">false</span></code>. Accepts a single
argument expression.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/anyElementTrue.html#exp._S_anyElementTrue" title="$anyElementTrue"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$anyElementTrue</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if <em>any</em> elements of a set evaluate to
<code class="docutils literal"><span class="pre">true</span></code>; otherwise, returns <code class="docutils literal"><span class="pre">false</span></code>. Accepts a single
argument expression.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/setDifference.html#exp._S_setDifference" title="$setDifference"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setDifference</span></code></a></td>
<td>Returns a set with elements that appear in the first set
but not in the second set; i.e. performs a <a class="reference external" href="http://en.wikipedia.org/wiki/Complement_(set_theory)">relative
complement</a>
of the second set relative to the first. Accepts exactly
two argument expressions.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/setEquals.html#exp._S_setEquals" title="$setEquals"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setEquals</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if the input sets have the same distinct
elements. Accepts two or more argument expressions.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/setIntersection.html#exp._S_setIntersection" title="$setIntersection"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setIntersection</span></code></a></td>
<td>Returns a set with elements that appear in <em>all</em> of the
input sets. Accepts any number of argument expressions.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/setIsSubset.html#exp._S_setIsSubset" title="$setIsSubset"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setIsSubset</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">true</span></code> if all elements of the first set appear
in the second set, including when the first set equals the
second set; i.e. not a <a class="reference external" href="http://en.wikipedia.org/wiki/Subset">strict subset</a>. Accepts exactly
two argument expressions.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/setUnion.html#exp._S_setUnion" title="$setUnion"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setUnion</span></code></a></td>
<td>Returns a set with elements that appear in <em>any</em> of the
input sets.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="string-expression-operators">
<h3>String Expression Operators<a class="headerlink" href="#string-expression-operators" title="Permalink to this headline">¶</a></h3>
<p>String expressions, with the exception of
<a class="reference internal" href="../reference/operator/aggregation/concat.html#exp._S_concat" title="$concat"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$concat</span></code></a>, only have a well-defined behavior for strings of ASCII characters.</p>
<p><a class="reference internal" href="../reference/operator/aggregation/concat.html#exp._S_concat" title="$concat"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$concat</span></code></a> behavior is well-defined regardless of
the characters used.</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/concat.html#exp._S_concat" title="$concat"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$concat</span></code></a></td>
<td>Concatenates any number of strings.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/dateFromString.html#exp._S_dateFromString" title="$dateFromString"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateFromString</span></code></a></td>
<td>Converts a date/time string to a date object.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/dateToString.html#exp._S_dateToString" title="$dateToString"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateToString</span></code></a></td>
<td>Returns the date as a formatted string.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/indexOfBytes.html#exp._S_indexOfBytes" title="$indexOfBytes"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$indexOfBytes</span></code></a></td>
<td>Searches a string for an occurence of a substring and returns
the UTF-8 byte index of the first occurence. If the substring
is not found, returns <code class="docutils literal"><span class="pre">-1</span></code>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/indexOfCP.html#exp._S_indexOfCP" title="$indexOfCP"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$indexOfCP</span></code></a></td>
<td>Searches a string for an occurence of a substring and returns
the UTF-8 code point index of the first occurence. If the
substring is not found, returns <code class="docutils literal"><span class="pre">-1</span></code></td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/ltrim.html#exp._S_ltrim" title="$ltrim"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ltrim</span></code></a></td>
<td><p class="first">Removes whitespace or the specified characters from the
beginning of a string.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/regexFind.html#exp._S_regexFind" title="$regexFind"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$regexFind</span></code></a></td>
<td><p class="first">Applies a regular expression (regex) to a string and returns
information on the <em>first</em> matched substring.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.2.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/regexFindAll.html#exp._S_regexFindAll" title="$regexFindAll"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$regexFindAll</span></code></a></td>
<td><p class="first">Applies a regular expression (regex) to a string and returns
information on the all matched substrings.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.2.</span></p>
</div>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/regexMatch.html#exp._S_regexMatch" title="$regexMatch"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$regexMatch</span></code></a></td>
<td><p class="first">Applies a regular expression (regex) to a string and returns
a boolean that indicates if a match is found or not.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.2.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/rtrim.html#exp._S_rtrim" title="$rtrim"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$rtrim</span></code></a></td>
<td><p class="first">Removes whitespace or the specified characters from the
end of a string.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/split.html#exp._S_split" title="$split"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$split</span></code></a></td>
<td>Splits a string into substrings based on a delimiter. Returns
an array of substrings. If the delimiter is not found within
the string, returns an array containing the original string.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/strLenBytes.html#exp._S_strLenBytes" title="$strLenBytes"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$strLenBytes</span></code></a></td>
<td>Returns the number of UTF-8 encoded bytes in a string.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/strLenCP.html#exp._S_strLenCP" title="$strLenCP"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$strLenCP</span></code></a></td>
<td>Returns the number of UTF-8 <a class="reference external" href="http://www.unicode.org/glossary/#code_point">code points</a> in a string.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/strcasecmp.html#exp._S_strcasecmp" title="$strcasecmp"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$strcasecmp</span></code></a></td>
<td>Performs case-insensitive string comparison and returns:
<code class="docutils literal"><span class="pre">0</span></code> if two strings are equivalent, <code class="docutils literal"><span class="pre">1</span></code> if the first
string is greater than the second, and <code class="docutils literal"><span class="pre">-1</span></code> if the first
string is less than the second.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/substr.html#exp._S_substr" title="$substr"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$substr</span></code></a></td>
<td>Deprecated. Use <a class="reference internal" href="../reference/operator/aggregation/substrBytes.html#exp._S_substrBytes" title="$substrBytes"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$substrBytes</span></code></a> or
<a class="reference internal" href="../reference/operator/aggregation/substrCP.html#exp._S_substrCP" title="$substrCP"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$substrCP</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/substrBytes.html#exp._S_substrBytes" title="$substrBytes"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$substrBytes</span></code></a></td>
<td>Returns the substring of a string. Starts with the character
at the specified UTF-8 byte index (zero-based) in the string
and continues for the specified number of bytes.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/substrCP.html#exp._S_substrCP" title="$substrCP"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$substrCP</span></code></a></td>
<td>Returns the substring of a string. Starts with the character
at the specified UTF-8 <a class="reference external" href="http://www.unicode.org/glossary/#code_point">code point (CP)</a> index
(zero-based) in the string and continues for the number of
code points specified.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/toLower.html#exp._S_toLower" title="$toLower"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toLower</span></code></a></td>
<td>Converts a string to lowercase. Accepts a single argument
expression.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/toString.html#exp._S_toString" title="$toString"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toString</span></code></a></td>
<td><p class="first">Converts value to a string.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/trim.html#exp._S_trim" title="$trim"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$trim</span></code></a></td>
<td><p class="first">Removes whitespace or the specified characters from the
beginning and end of a string.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/toUpper.html#exp._S_toUpper" title="$toUpper"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toUpper</span></code></a></td>
<td>Converts a string to uppercase. Accepts a single argument
expression.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="text-expression-operator">
<h3>Text Expression Operator<a class="headerlink" href="#text-expression-operator" title="Permalink to this headline">¶</a></h3>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/meta.html#exp._S_meta" title="$meta"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$meta</span></code></a></td>
<td>Access text search metadata.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="trigonometry-expression-operators">
<span id="agg-quick-ref-operator-trigonometry"></span><h3>Trigonometry Expression Operators<a class="headerlink" href="#trigonometry-expression-operators" title="Permalink to this headline">¶</a></h3>
<p>Trigonometry expressions perform trigonometric operations on numbers.
Values that represent angles are always input or output in  radians. Use
<a class="reference internal" href="../reference/operator/aggregation/degreesToRadians.html#exp._S_degreesToRadians" title="$degreesToRadians"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$degreesToRadians</span></code></a> and <a class="reference internal" href="../reference/operator/aggregation/radiansToDegrees.html#exp._S_radiansToDegrees" title="$radiansToDegrees"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$radiansToDegrees</span></code></a> to
convert between degree and radian measurements.</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/sin.html#exp._S_sin" title="$sin"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$sin</span></code></a></td>
<td>Returns the sine of a value that is measured in radians.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/cos.html#exp._S_cos" title="$cos"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$cos</span></code></a></td>
<td>Returns the cosine of a value that is measured in radians.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/tan.html#exp._S_tan" title="$tan"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$tan</span></code></a></td>
<td>Returns the tangent of a value that is measured in radians.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/asin.html#exp._S_asin" title="$asin"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$asin</span></code></a></td>
<td>Returns the inverse sin (arc sine) of a value in radians.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/acos.html#exp._S_acos" title="$acos"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$acos</span></code></a></td>
<td>Returns the inverse cosine (arc cosine) of a value in radians.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/atan.html#exp._S_atan" title="$atan"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$atan</span></code></a></td>
<td>Returns the inverse tangent (arc tangent) of a value in
radians.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/atan2.html#exp._S_atan2" title="$atan2"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$atan2</span></code></a></td>
<td>Returns the inverse tangent (arc tangent) of <code class="docutils literal"><span class="pre">y</span> <span class="pre">/</span> <span class="pre">x</span></code> in
radians, where <code class="docutils literal"><span class="pre">y</span></code> and <code class="docutils literal"><span class="pre">x</span></code> are the first and second
values passed to the expression respectively.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/asinh.html#exp._S_asinh" title="$asinh"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$asinh</span></code></a></td>
<td>Returns the inverse hyperbolic sine (hyperbolic arc sine) of a
value in radians.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/acosh.html#exp._S_acosh" title="$acosh"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$acosh</span></code></a></td>
<td>Returns the inverse hyperbolic cosine (hyperbolic arc cosine)
of a value in radians.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/atanh.html#exp._S_atanh" title="$atanh"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$atanh</span></code></a></td>
<td>Returns the inverse hyperbolic tangent (hyperbolic arc
tangent) of a value in radians.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/degreesToRadians.html#exp._S_degreesToRadians" title="$degreesToRadians"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$degreesToRadians</span></code></a></td>
<td>Converts a value from degrees to radians.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/radiansToDegrees.html#exp._S_radiansToDegrees" title="$radiansToDegrees"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$radiansToDegrees</span></code></a></td>
<td>Converts a value from radians to degrees.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="type-expression-operators">
<h3>Type Expression Operators<a class="headerlink" href="#type-expression-operators" title="Permalink to this headline">¶</a></h3>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/convert.html#exp._S_convert" title="$convert"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$convert</span></code></a></td>
<td><p class="first">Converts a value to a specified type.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/toBool.html#exp._S_toBool" title="$toBool"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toBool</span></code></a></td>
<td><p class="first">Converts value to a boolean.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/toDate.html#exp._S_toDate" title="$toDate"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toDate</span></code></a></td>
<td><p class="first">Converts value to a Date.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/toDecimal.html#exp._S_toDecimal" title="$toDecimal"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toDecimal</span></code></a></td>
<td><p class="first">Converts value to a Decimal128.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/toDouble.html#exp._S_toDouble" title="$toDouble"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toDouble</span></code></a></td>
<td><p class="first">Converts value to a double.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/toInt.html#exp._S_toInt" title="$toInt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toInt</span></code></a></td>
<td><p class="first">Converts value to an integer.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/toLong.html#exp._S_toLong" title="$toLong"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toLong</span></code></a></td>
<td><p class="first">Converts value to a long.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/toObjectId.html#exp._S_toObjectId" title="$toObjectId"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toObjectId</span></code></a></td>
<td><p class="first">Converts value to an ObjectId.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/toString.html#exp._S_toString" title="$toString"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toString</span></code></a></td>
<td><p class="first">Converts value to a string.</p>
<div class="last versionadded">
<p><span class="versionmodified">New in version 4.0.</span></p>
</div>
</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/type.html#exp._S_type" title="$type"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$type</span></code></a></td>
<td>Return the BSON data type of the field.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="accumulators-group">
<span id="agg-quick-reference-accumulators"></span><span id="aggregation-accumulator-operators"></span><h3>Accumulators (<code class="docutils literal"><span class="pre">$group</span></code>)<a class="headerlink" href="#accumulators-group" title="Permalink to this headline">¶</a></h3>
<p>Available for use in the <a class="reference internal" href="../reference/operator/aggregation/group.html#pipe._S_group" title="$group"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$group</span></code></a> stage, accumulators are
operators that maintain their state (e.g. totals, maximums, minimums,
and related data) as documents progress through the pipeline.</p>
<p>When used as accumulators in the <a class="reference internal" href="../reference/operator/aggregation/group.html#pipe._S_group" title="$group"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$group</span></code></a> stage, these
operators take as input a single expression, evaluating the expression
once for each input document, and maintain their stage for the group of
documents that share the same group key.</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/addToSet.html#grp._S_addToSet" title="$addToSet"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$addToSet</span></code></a></td>
<td>Returns an array of <em>unique</em> expression values for each
group. Order of the array elements is undefined.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/avg.html#grp._S_avg" title="$avg"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$avg</span></code></a></td>
<td>Returns an average of numerical values. Ignores non-numeric values.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/first.html#grp._S_first" title="$first"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$first</span></code></a></td>
<td>Returns a value from the first document for each group. Order
is only defined if the documents are in a defined order.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/last.html#grp._S_last" title="$last"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$last</span></code></a></td>
<td>Returns a value from the last document for each group. Order
is only defined if the documents are in a defined order.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/max.html#grp._S_max" title="$max"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$max</span></code></a></td>
<td>Returns the highest expression value for each group.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/mergeObjects.html#exp._S_mergeObjects" title="$mergeObjects"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$mergeObjects</span></code></a></td>
<td>Returns a document created by combining the input documents
for each group.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/min.html#grp._S_min" title="$min"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$min</span></code></a></td>
<td>Returns the lowest expression value for each group.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/push.html#grp._S_push" title="$push"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$push</span></code></a></td>
<td>Returns an array of expression values for each group.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/stdDevPop.html#grp._S_stdDevPop" title="$stdDevPop"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$stdDevPop</span></code></a></td>
<td>Returns the population standard deviation of the input values.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/stdDevSamp.html#grp._S_stdDevSamp" title="$stdDevSamp"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$stdDevSamp</span></code></a></td>
<td>Returns the sample standard deviation of the input values.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/sum.html#grp._S_sum" title="$sum"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$sum</span></code></a></td>
<td>Returns a sum of numerical values. Ignores non-numeric values.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="accumulators-in-other-stages">
<h3>Accumulators (in Other Stages)<a class="headerlink" href="#accumulators-in-other-stages" title="Permalink to this headline">¶</a></h3>
<p>Some operators that are available as accumulators for the
<a class="reference internal" href="../reference/operator/aggregation/group.html#pipe._S_group" title="$group"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$group</span></code></a> stage are also available for use in other stages but
not as accumulators. When used in these other stages, these operators
do not maintain their state and can take as input either a single
argument or multiple arguments. For details, refer to the specific
operator page.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.2.</span></p>
</div>
<p>The following accumulator operators are also available in the
<a class="reference internal" href="../reference/operator/aggregation/project.html#pipe._S_project" title="$project"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$project</span></code></a>, <a class="reference internal" href="../reference/operator/aggregation/addFields.html#pipe._S_addFields" title="$addFields"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$addFields</span></code></a>, and <a class="reference internal" href="../reference/operator/aggregation/set.html#pipe._S_set" title="$set"><code class="xref mongodb mongodb-pipeline docutils literal"><span class="pre">$set</span></code></a> stages.</p>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/avg.html#grp._S_avg" title="$avg"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$avg</span></code></a></td>
<td>Returns an average of the specified expression or list of
expressions for each document. Ignores non-numeric values.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/max.html#grp._S_max" title="$max"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$max</span></code></a></td>
<td>Returns the maximum of the specified expression or list of
expressions for each document</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/min.html#grp._S_min" title="$min"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$min</span></code></a></td>
<td>Returns the minimum of the specified expression or list of
expressions for each document</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/stdDevPop.html#grp._S_stdDevPop" title="$stdDevPop"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$stdDevPop</span></code></a></td>
<td>Returns the population standard deviation of the input values.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/stdDevSamp.html#grp._S_stdDevSamp" title="$stdDevSamp"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$stdDevSamp</span></code></a></td>
<td>Returns the sample standard deviation of the input values.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="../reference/operator/aggregation/sum.html#grp._S_sum" title="$sum"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$sum</span></code></a></td>
<td>Returns a sum of numerical values. Ignores non-numeric values.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="variable-expression-operators">
<h3>Variable Expression Operators<a class="headerlink" href="#variable-expression-operators" title="Permalink to this headline">¶</a></h3>
<table border="1" class="colwidths-given docutils">
<colgroup>
<col width="20%" />
<col width="80%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Name</th>
<th class="head">Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="../reference/operator/aggregation/let.html#exp._S_let" title="$let"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$let</span></code></a></td>
<td><p class="first">Defines variables for use within the scope of a subexpression
and returns the result of the subexpression. Accepts named
parameters.</p>
<p class="last">Accepts any number of argument expressions.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="index-of-expression-operators">
<h2>Index of Expression Operators<a class="headerlink" href="#index-of-expression-operators" title="Permalink to this headline">¶</a></h2>
<table class="hlist"><tr><td><ul class="simple">
<li><a class="reference internal" href="../reference/operator/aggregation/abs.html#exp._S_abs" title="$abs"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$abs</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/acos.html#exp._S_acos" title="$acos"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$acos</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/acosh.html#exp._S_acosh" title="$acosh"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$acosh</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/add.html#exp._S_add" title="$add"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$add</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/addToSet.html#grp._S_addToSet" title="$addToSet"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$addToSet</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/allElementsTrue.html#exp._S_allElementsTrue" title="$allElementsTrue"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$allElementsTrue</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/and.html#exp._S_and" title="$and"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$and</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/anyElementTrue.html#exp._S_anyElementTrue" title="$anyElementTrue"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$anyElementTrue</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/arrayElemAt.html#exp._S_arrayElemAt" title="$arrayElemAt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$arrayElemAt</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/arrayToObject.html#exp._S_arrayToObject" title="$arrayToObject"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$arrayToObject</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/asin.html#exp._S_asin" title="$asin"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$asin</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/asinh.html#exp._S_asinh" title="$asinh"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$asinh</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/atan.html#exp._S_atan" title="$atan"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$atan</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/atan2.html#exp._S_atan2" title="$atan2"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$atan2</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/atanh.html#exp._S_atanh" title="$atanh"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$atanh</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/avg.html#grp._S_avg" title="$avg"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$avg</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/ceil.html#exp._S_ceil" title="$ceil"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ceil</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/cmp.html#exp._S_cmp" title="$cmp"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$cmp</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/concat.html#exp._S_concat" title="$concat"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$concat</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/concatArrays.html#exp._S_concatArrays" title="$concatArrays"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$concatArrays</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/cond.html#exp._S_cond" title="$cond"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$cond</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/convert.html#exp._S_convert" title="$convert"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$convert</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/cos.html#exp._S_cos" title="$cos"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$cos</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/dateFromParts.html#exp._S_dateFromParts" title="$dateFromParts"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateFromParts</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/dateFromString.html#exp._S_dateFromString" title="$dateFromString"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateFromString</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/dateToParts.html#exp._S_dateToParts" title="$dateToParts"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateToParts</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/dateToString.html#exp._S_dateToString" title="$dateToString"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dateToString</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/dayOfMonth.html#exp._S_dayOfMonth" title="$dayOfMonth"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dayOfMonth</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/dayOfWeek.html#exp._S_dayOfWeek" title="$dayOfWeek"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dayOfWeek</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/dayOfYear.html#exp._S_dayOfYear" title="$dayOfYear"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$dayOfYear</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/degreesToRadians.html#exp._S_degreesToRadians" title="$degreesToRadians"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$degreesToRadians</span></code></a></li>
</ul>
</td><td><ul class="simple">
<li><a class="reference internal" href="../reference/operator/aggregation/divide.html#exp._S_divide" title="$divide"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$divide</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/eq.html#exp._S_eq" title="$eq"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$eq</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/exp.html#exp._S_exp" title="$exp"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$exp</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/filter.html#exp._S_filter" title="$filter"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$filter</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/first.html#grp._S_first" title="$first"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$first</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/floor.html#exp._S_floor" title="$floor"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$floor</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/gt.html#exp._S_gt" title="$gt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$gt</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/gte.html#exp._S_gte" title="$gte"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$gte</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/hour.html#exp._S_hour" title="$hour"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$hour</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/ifNull.html#exp._S_ifNull" title="$ifNull"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ifNull</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/in.html#exp._S_in" title="$in"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$in</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/indexOfArray.html#exp._S_indexOfArray" title="$indexOfArray"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$indexOfArray</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/indexOfBytes.html#exp._S_indexOfBytes" title="$indexOfBytes"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$indexOfBytes</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/indexOfCP.html#exp._S_indexOfCP" title="$indexOfCP"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$indexOfCP</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/isArray.html#exp._S_isArray" title="$isArray"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$isArray</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/isoDayOfWeek.html#exp._S_isoDayOfWeek" title="$isoDayOfWeek"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$isoDayOfWeek</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/isoWeek.html#exp._S_isoWeek" title="$isoWeek"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$isoWeek</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/isoWeekYear.html#exp._S_isoWeekYear" title="$isoWeekYear"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$isoWeekYear</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/last.html#grp._S_last" title="$last"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$last</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/let.html#exp._S_let" title="$let"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$let</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/literal.html#exp._S_literal" title="$literal"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$literal</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/ln.html#exp._S_ln" title="$ln"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ln</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/log.html#exp._S_log" title="$log"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$log</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/log10.html#exp._S_log10" title="$log10"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$log10</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/lt.html#exp._S_lt" title="$lt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$lt</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/lte.html#exp._S_lte" title="$lte"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$lte</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/ltrim.html#exp._S_ltrim" title="$ltrim"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ltrim</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/map.html#exp._S_map" title="$map"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$map</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/max.html#grp._S_max" title="$max"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$max</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/mergeObjects.html#exp._S_mergeObjects" title="$mergeObjects"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$mergeObjects</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/meta.html#exp._S_meta" title="$meta"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$meta</span></code></a></li>
</ul>
</td><td><ul class="simple">
<li><a class="reference internal" href="../reference/operator/aggregation/millisecond.html#exp._S_millisecond" title="$millisecond"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$millisecond</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/min.html#grp._S_min" title="$min"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$min</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/minute.html#exp._S_minute" title="$minute"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$minute</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/mod.html#exp._S_mod" title="$mod"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$mod</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/month.html#exp._S_month" title="$month"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$month</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/multiply.html#exp._S_multiply" title="$multiply"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$multiply</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/ne.html#exp._S_ne" title="$ne"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$ne</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/not.html#exp._S_not" title="$not"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$not</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/objectToArray.html#exp._S_objectToArray" title="$objectToArray"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$objectToArray</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/or.html#exp._S_or" title="$or"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$or</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/pow.html#exp._S_pow" title="$pow"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$pow</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/push.html#grp._S_push" title="$push"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$push</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/radiansToDegrees.html#exp._S_radiansToDegrees" title="$radiansToDegrees"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$radiansToDegrees</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/range.html#exp._S_range" title="$range"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$range</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/reduce.html#exp._S_reduce" title="$reduce"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$reduce</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/regexFind.html#exp._S_regexFind" title="$regexFind"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$regexFind</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/regexFindAll.html#exp._S_regexFindAll" title="$regexFindAll"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$regexFindAll</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/regexMatch.html#exp._S_regexMatch" title="$regexMatch"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$regexMatch</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/reverseArray.html#exp._S_reverseArray" title="$reverseArray"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$reverseArray</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/round.html#exp._S_round" title="$round"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$round</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/rtrim.html#exp._S_rtrim" title="$rtrim"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$rtrim</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/second.html#exp._S_second" title="$second"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$second</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/setDifference.html#exp._S_setDifference" title="$setDifference"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setDifference</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/setEquals.html#exp._S_setEquals" title="$setEquals"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setEquals</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/setIntersection.html#exp._S_setIntersection" title="$setIntersection"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setIntersection</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/setIsSubset.html#exp._S_setIsSubset" title="$setIsSubset"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setIsSubset</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/setUnion.html#exp._S_setUnion" title="$setUnion"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$setUnion</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/sin.html#exp._S_sin" title="$sin"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$sin</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/size.html#exp._S_size" title="$size"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$size</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/slice.html#exp._S_slice" title="$slice"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$slice</span></code></a></li>
</ul>
</td><td><ul class="simple">
<li><a class="reference internal" href="../reference/operator/aggregation/split.html#exp._S_split" title="$split"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$split</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/sqrt.html#exp._S_sqrt" title="$sqrt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$sqrt</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/stdDevPop.html#grp._S_stdDevPop" title="$stdDevPop"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$stdDevPop</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/stdDevSamp.html#grp._S_stdDevSamp" title="$stdDevSamp"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$stdDevSamp</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/strLenBytes.html#exp._S_strLenBytes" title="$strLenBytes"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$strLenBytes</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/strLenCP.html#exp._S_strLenCP" title="$strLenCP"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$strLenCP</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/strcasecmp.html#exp._S_strcasecmp" title="$strcasecmp"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$strcasecmp</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/substr.html#exp._S_substr" title="$substr"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$substr</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/substrBytes.html#exp._S_substrBytes" title="$substrBytes"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$substrBytes</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/substrCP.html#exp._S_substrCP" title="$substrCP"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$substrCP</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/subtract.html#exp._S_subtract" title="$subtract"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$subtract</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/sum.html#grp._S_sum" title="$sum"><code class="xref mongodb mongodb-group docutils literal"><span class="pre">$sum</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/switch.html#exp._S_switch" title="$switch"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$switch</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/tan.html#exp._S_tan" title="$tan"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$tan</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toBool.html#exp._S_toBool" title="$toBool"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toBool</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toDate.html#exp._S_toDate" title="$toDate"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toDate</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toDecimal.html#exp._S_toDecimal" title="$toDecimal"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toDecimal</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toDouble.html#exp._S_toDouble" title="$toDouble"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toDouble</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toInt.html#exp._S_toInt" title="$toInt"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toInt</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toLong.html#exp._S_toLong" title="$toLong"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toLong</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toLower.html#exp._S_toLower" title="$toLower"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toLower</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toObjectId.html#exp._S_toObjectId" title="$toObjectId"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toObjectId</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toString.html#exp._S_toString" title="$toString"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toString</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/toUpper.html#exp._S_toUpper" title="$toUpper"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$toUpper</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/trim.html#exp._S_trim" title="$trim"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$trim</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/trunc.html#exp._S_trunc" title="$trunc"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$trunc</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/type.html#exp._S_type" title="$type"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$type</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/week.html#exp._S_week" title="$week"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$week</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/year.html#exp._S_year" title="$year"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$year</span></code></a></li>
<li><a class="reference internal" href="../reference/operator/aggregation/zip.html#exp._S_zip" title="$zip"><code class="xref mongodb mongodb-expression docutils literal"><span class="pre">$zip</span></code></a></li>
</ul>
</td></tr></table>
</div>
</div>

                
    <div id="btnv">
      <span class="btn-arrow-left">&larr; &nbsp;</span>
      <a class="btn-prev-text" href="../reference/aggregation.html" title="Previous Section: Aggregation Reference"><span>Aggregation Reference</span></a>
      <a class="btn-next-text" href="../reference/operator/aggregation/interface.html" title="Next Section: Aggregation Commands"><span>Aggregation Commands</span></a>
      <span class="btn-arrow-right">&nbsp;&rarr;</span>
    </div>
                  <div class="footer">
                    <div class="copyright">
                      <p>&copy; MongoDB, Inc 2008-present. MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc.</p>
                    </div>
                  </div>
              </div></div>
            </div>
        </div>
    </div>
    <div class="right-column">
      <div class="wrapper"> <div id='mongodb-docs-1'>
   <script type='text/javascript'>
      googletag.cmd.push(function() { googletag.display('mongodb-docs-1'); });
   </script>
</div>
            <div class="social">
               <a class="slack-icon" href="https://slackpass.io/mongo-db?jmp=docs" title="https://slackpass.io/mongo-db?jmp=docs"><i class="fab fa-slack" aria-hidden="true"></i></a>
               <a class="twitter-icon" href="https://twitter.com/MongoDB" title="https://twitter.com/MongoDB"><i class="fab fa-twitter-square"></i></a>
               <a class="youtube-icon" href="https://www.youtube.com/user/MongoDB" title="https://www.youtube.com/user/MongoDB"><i class="fab fa-youtube-square"></i></a>
               <a class="facebook-icon" href="https://www.facebook.com/mongodb" title="https://www.facebook.com/mongodb"><i class="fab fa-facebook-square"></i></a>
               <a class="stack-overflow-icon" href="https://stackoverflow.com/tags/mongodb/info" title="https://stackoverflow.com/tags/mongodb/info"><i class="fab fa-stack-overflow" aria-hidden="true"></i></a>
            </div>
        

      </div>
    </div>
    
      <div id="rating-panel"></div>
    
    <div class="clearfix"></div>
  </div>
  

  <script type="text/javascript">
  // Bootstrap array of links that should trigger a full page reload
  window.docsExcludedNav = ['/administration', '/administration/production-checklist', '/administration/indexes-management', '/aggregation', '/applications/geospatial-indexes', '/applications/indexes', '/contributors/getting-started', '/core/2d', '/core/2dsphere', '/core/auditing', '/core/authentication', '/core/authorization', '/core/backups', '/core/read-isolation-consistency-recency', '/core/databases-and-collections', '/core/geohaystack', '/core/index-single', '/core/index-compound', '/core/index-creation', '/core/index-hashed', '/core/index-multikey', '/core/index-partial', '/core/index-sparse', '/core/index-text', '/core/index-ttl', '/core/index-unique', '/core/index-wildcard', '/core/journaling', '/core/kerberos', '/core/map-reduce', '/core/operational-segregation', '/core/query-optimization', '/core/read-preference', '/core/replica-set-architectures', '/core/replica-set-high-availability', '/core/replica-set-members', '/core/replica-set-secondary', '/core/transactions', '/geospatial-queries', '/replication', '/core/sharded-cluster-components', '/core/wiredtiger', '/core/write-operations-atomicity', '/crud', '/indexes', '/installation', '/introduction', '/mongo', '/products/bi-connector', '/reference/command', '/reference/collation', '/text-search', '/tutorial/manage-the-database-profiler', '/core/index-text', '/reference/bson-types', '/reference/configuration-options', '/reference/indexes', '/reference/method', '/reference/operator/aggregation', '/reference/operator/query', '/reference/operator/query-modifier', '/reference/operator/update', '/reference/replication', '/reference/read-concern', '/reference/security', '/reference/sharding', '/reference/write-concern', '/release-notes/2.4', '/release-notes/2.6', '/release-notes/2.8', '/release-notes/3.0', '/release-notes/3.2', '/release-notes/3.4', '/release-notes/3.6', '/release-notes/4.0', '/release-notes/4.2', '/security', '/sharding', '/changeStreams', '/core/zone-sharding', '/core/hashed-sharding', '/core/ranged-sharding', '/storage', '/tutorial/change-sharded-cluster-wiredtiger', '/tutorial/insert-documents', '/tutorial/query-documents', '/tutorial/remove-documents', '/tutorial/update-documents', '/tutorial/enable-authentication', '/tutorial/install-mongodb-on-ubuntu', '/tutorial/install-mongodb-on-windows', '/tutorial/install-mongodb-on-red-hat', '/tutorial/install-mongodb-on-debian', '/tutorial/install-mongodb-on-suse', '/tutorial/install-mongodb-on-amazon', '/tutorial/install-mongodb-enterprise-on-ubuntu', '/tutorial/install-mongodb-enterprise-on-windows', '/tutorial/install-mongodb-enterprise-on-red-hat', '/tutorial/install-mongodb-enterprise-on-debian', '/tutorial/install-mongodb-enterprise-on-suse', '/tutorial/install-mongodb-enterprise-on-amazon', '/tutorial/install-mongodb-on-os-x'];
  </script></body>
</html>